Below is my script
%let rpt_date="30Nov2021"d;
%let rpt_date2=%sysfunc(put(&rpt_date.,yymmddn8.));
%put rpt_date2 is &rpt_date2.;
data b;
seattle=put(&rpt_date.,yymmddn8.)
;
run;
What I want to achieve is to convert the function in Dataset b it into a macro variable (rpt_date2) that shows character value in YYYYMMDD. However, I am getting the following error.
ERROR: The PUT function referenced in the %SYSFUNC or %QSYSFUNC macro function is not found.
What could possible be wrong when converting the function that works in a datastep into a macro variable?
You must use the datatype specific version of the PUT function PUTC/PUTN with %SYSFUNC. See documentation for others.
34 %let rpt_date="30Nov2021"d;
35 %let rpt_date2=%sysfunc(putn(&rpt_date.,yymmddn8.));
36 %put NOTE: &=rpt_date2;
NOTE: RPT_DATE2=20211130
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.