Hi!
Brand spanking new to SAS.
I'm trying the following:
%LET CURRENT_DAY=TODAY();
RUN;
.
.
.
%put 'Today is ' &CURRENT_DAY.;
.
.
quit;
AND I GET:
'Today is' TODAY()
What do I need to do to get the value of TODAY() ?
THX.
Try using %SYSFUNC like the following:
%LET CURRENT_DAY=%sysfunc(TODAY());
Try using %SYSFUNC like the following:
%LET CURRENT_DAY=%sysfunc(TODAY());
The question indicates perhaps you need to learn a bit more basic SAS coding before attempting the macro language. Macros are often not needed and your time would be better spent learning the basics.
Data _null_;
currentdate = today();
put 'Today is ' CURRENT_DAY;
run;
BUT this is likely not what you expect as the date is number of days and a format should be applied.
Data _null_;
currentdate = today();
put 'Today is ' CURRENT_DAY date9.;
run;
To use functions from the data step language you need to enclose the call within %sysfunc(today()) to tell the macro language to engage the data step function. Otherwise it only generates text.
Note that you may be able to use the automatic SAS variable &sysdate. Maybe. There are some details involved that you should read in the documentation.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.