DATA Step, Macro, Functions and more

Sas - keep only observations between 2 dates

Reply
Contributor
Posts: 57

Sas - keep only observations between 2 dates

Hello,

I am trying to keep all dates in a table that occur between -365 to -30 days prior to Index date. Any dates occurring within 30 days of the Index are not required. I know this is probably quite straightforward code but I can't seem to figure out how to do this.  Any help on the syntax would be appreciated. Many thanks.

Super User
Posts: 17,784

Re: Sas - keep only observations between 2 dates

Is index date a fixed date or a column in a dat set?

Assuming fixed date and variables that are SAS dates something like the following:

where (fixed_date - date) between 30 and 365;

You may need to change signs or order of subtraction.

Ask a Question
Discussion stats
  • 1 reply
  • 192 views
  • 0 likes
  • 2 in conversation