1. How to convert macro variable from format 2011-01-01 to 01Jan2011. I know how to do it in data step bud don't know how to do it in macro - i need to use reformatted macro variable in a macro and use it with changed format for PROC SQL purposes.
Working data step:
data _null_;
data = '2011-01-24';
data = INPUT(data, yymmdd10.);
FORMAT data1 DATE9.;
put data ;
run;
Please help to executa that in macro in order to get changed &date macro variable with the same name.
How about:
data _null_;
dt = '2011-01-24';
data = INPUT(dt, yymmdd10.);
call symput( 'data', put( data, date9. ));
run;
%put &data;
Are you after something like below?
%let HaveDateString=2011-01-01;
%let WantDateString=%sysfunc(inputn(&HaveDateString,yymmdd10.),date9.);
%put WantDateString= &WantDateString;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.