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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.