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.

CFC_SAS_Communities_400x225.jpgCFC_SAS_Communities_400x225.jpg

Call for content now open!

It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.

Submit your proposal →

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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