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

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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