I'm assigning a macro variable as such: %let weeks2=31 ;
but instead of 31 i want the variable to automatically be the current weeknumber.
I've tried using weeks2=week(today(), 'u') but this returns an error.
Any ideas?
Thanks in advance!!
You've got the right idea. However, you are trying to use SAS functions ( week
and today
) in a macro statement ( %let
). When doing so, you have to call each SAS function using the %sysfunc
macro function:
%let weeks2=%sysfunc(week(%sysfunc(today()), u));
Also, arguments need not be quoted in macro functions (the u
argument in this case).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.