LMS
LMS

Reputation: 9

Why am I getting an integer error from SAS date and how do I correct it?

Can anyone see what I have incorrect on this date macro? I want sysdate - 7 days, I want to go back one week for the date.

"WEEK OVER WEEK COMPARISON SUMMARY" @&sysdate -7 Format=MMDDYYS10.;
    
  1 line "WEEK OVER WEEK COMPARISON SUMMARY" @10JUN22 -7 Format=MMDDYYS10.;
                                                              _
                                                              22
ERROR 22-322: Expecting an integer constant.

Upvotes: 0

Views: 156

Answers (1)

Richard
Richard

Reputation: 27508

In a macro context date arithmetic can be done with %sysfunc(intnx... %sysfunc has a parameter for specifying the format of the computed result when it is returned to the macro system as source.

So, your macro implementation might need to be changed to

"WEEK OVER WEEK COMPARISON SUMMARY - %sysfunc(intnx(day,"&sysdate"d,-7), mmddyys10.)";

Upvotes: 1

Related Questions