Hi....I have a large dataset and would like to select the records (rows) that have a claim date that is greater than the 'Date As Of' for only the product number in the specified group. Any suggestions?...Thanks in Advance
Group | Product_Number | Date As Of |
FS | 00000086 | 19970818 |
PA | 00000086 | 19970818 |
FS | 00000302 | 20060612 |
PA | 00000302 | 20060612 |
PA | 00000655 | 20120814 |
FS | 00000655 | 20120814 |
MB | 00000655 | 20120814 |
MB | 00000663 | 20130228 |
FS | 00000663 | 20130228 |
PA | 00000663 | 20130228 |
MB | 00001082 | 20110804 |
FS | 00001082 | 20110804 |
PA | 00001082 | 20110804 |
FS | 00001120 | 20110804 |
MB | 00001120 | 20110804 |
PA | 00001120 | 20110804 |
FS | 00001287 | 20110804 |
MB | 00001287 | 20110804 |
PA | 00001287 | 20110804 |
MB | 00001317 | 20110804 |
FS | 00001317 | 20110804 |
PA | 00001317 | 20110804 |
NH | 00001341 | 20110804 |
MB | 00001341 | 20110804 |
FS | 00001341 | 20110804 |
Something like (and not tested):
proc sql;
create table WANT as
select A.*
from CLAIM_DATASET A
left join (select distinct GROUP,DATE_AS_OF from HAVE) B
on A.GROUP=B.GROUP
and A.CLAIM_DATE > B.DATE_AS_OF;
quit;
Assumes both dates are actually date values.
More details. You don't show a claim date. Where is that value going to come from for comparison?
The claim date, along with the variables Group and Product Number as well other variables are on another dataset named ClaimData. The ClaimData is the large dataset that I want to select a subset from based on only if the Group, Product Number match from the list above and the Claim Date Must be greater than 'Date As Of' variable.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.