BookmarkSubscribeRSS Feed
sas_9
Obsidian | Level 7

Here i want to generate report from date 15thoct to 22oct. i am wondering what logic should be for second data  _null_ statement to generate data for same date.

Infirst data _null_ statement, i have changed date to '22oct11'd for same date 1 and date2. i am not sure about what date logic for second data _null_statement.

Please guide....

Thanks.

3 REPLIES 3
Tom
Super User Tom
Super User

Can you explain more what you want to happen.  I looks to me that you are creating DATE1 and DATE2 macro variables in the first data step and then just referencing them in the second.  What else do you want to do?

sas_9
Obsidian | Level 7

OK. sir. this is my weekly bundle process but it was failed to run last week so i just want to pullup data for date 15th oct -22nd oct, so if i change date( ) to '22oct11' d for both date1 and date2, dataset will pullup data for same date that i want but i am not sure what date logic should be for second data _null_ statement. Is there anything need to be change in that or not?

Thanks,

Sandip.

barheat
Fluorite | Level 6

I run many batch jobs for various time periods. Here is a typical data step to create two macro variables for the start and end of the previous week;

data date_parms;

  analysis_date=today();

  date1=intnx('week',analysis_date,-1);

  date2=intnx('week',analysis_date,-1,'end);

  call symputx('start_date',date1);

  call symputx('end_date',date2);

  format analysis_date, date1 date2 date7.;)

run;

&start_date and &end_date are macro variables for the start and end of the previous week. If you need to rerun the program for a prior week you just need to change the analysis_date to a prior week.

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 3 replies
  • 1320 views
  • 1 like
  • 3 in conversation