DATA Step, Macro, Functions and more

re: Selecting Records

Reply
Regular Contributor
Posts: 222

re: Selecting Records

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
Super User
Super User
Posts: 7,430

Re: re: Selecting Records

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.

Super User
Posts: 10,550

Re: re: Selecting Records

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

Regular Contributor
Posts: 222

Re: re: Selecting Records

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.

Ask a Question
Discussion stats
  • 3 replies
  • 201 views
  • 0 likes
  • 3 in conversation