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

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!

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.

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