BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hello All,
I am trying to get a report of all the obs for the week ending a week before today. For eg. if today is 5/19/10. I would like to get all the observations for the week of 5/5/10 - 5/12/10. I am running a DI job to do this, but I am not sure on how to specify the date ranges. Can anyone offer any suggestions.


Thank You

Shri
2 REPLIES 2
Doc_Duke
Rhodochrosite | Level 12
Shri,

I'm not a DI user. But the appropriate selection in an IF statement from the data step would look something like

IF today()-14 LE obsdate LE today()-7 THEN ...

or a SQL WHERE expression of
obsdate BETWEEN today()-14 AND today()-7

I suspect that DI would use one of those two approaches. Message was edited by: Doc@Duke
LinusH
Tourmaline | Level 20
You use SAS Extract transform in DI Studio, or potentiality SQL Join if more than one table is involved.

If your data is huge, or reside in an external RDBMS, consider to calculate the start and end dates of the BETWEEN interval in a pre-process. Store them as macro variables, for use in the Extract.
The use of functions and calculation can prevent SAS from using indexes, or to send the code to the RDBMS for execution.

/Linus
Data never sleeps

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 2 replies
  • 1087 views
  • 0 likes
  • 3 in conversation