DATA Step, Macro, Functions and more

Help for date logic to generate week to week report

Reply
Regular Contributor
Posts: 220

Help for date logic to generate week to week report

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.

Attachment
Super User
Super User
Posts: 6,502

Help for date logic to generate week to week report

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?

Regular Contributor
Posts: 220

Help for date logic to generate week to week report

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.

Contributor
Posts: 36

Help for date logic to generate week to week report

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.Smiley Wink

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.

Ask a Question
Discussion stats
  • 3 replies
  • 198 views
  • 0 likes
  • 3 in conversation