BookmarkSubscribeRSS Feed
StickyRoll
Fluorite | Level 6

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?

1 REPLY 1
data_null__
Jade | Level 19

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
How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 5001 views
  • 2 likes
  • 2 in conversation