BookmarkSubscribeRSS Feed
twildone
Pyrite | Level 9

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

GroupProduct_NumberDate As Of
FS0000008619970818
PA0000008619970818
FS0000030220060612
PA0000030220060612
PA0000065520120814
FS0000065520120814
MB0000065520120814
MB0000066320130228
FS0000066320130228
PA0000066320130228
MB0000108220110804
FS0000108220110804
PA0000108220110804
FS0000112020110804
MB0000112020110804
PA0000112020110804
FS0000128720110804
MB0000128720110804
PA0000128720110804
MB0000131720110804
FS0000131720110804
PA0000131720110804
NH0000134120110804
MB0000134120110804
FS0000134120110804
3 REPLIES 3
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

ballardw
Super User

More details. You don't show a claim date. Where is that value going to come from for comparison?

twildone
Pyrite | Level 9

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.

sas-innovate-2024.png

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.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 715 views
  • 0 likes
  • 3 in conversation