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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 644 views
  • 0 likes
  • 3 in conversation