I am trying to create macro variables as mm, dd, yy and yyyy from a today()-1 date.
I have the variables coming out correctly but when I put them in my code to assign the value there are large spaces that are causing the code to fail.
Log Results (below code) give the correct info but there are spaces I don't want and I don't know how to remove them.
This is my code.
%LET INITIAL_DT = %SYSFUNC(TODAY(),DATE9.);
%PUT &INITIAL_DT. ;
DATA _NULL_;
CALL SYMPUT ('INITIAL_DT', "&INITIAL_DT"D);
RUN;
%PUT &INITIAL_DT. ;
DATA _NULL_ ;
format
m2 2. /* mm = 01 - 12 and dd = 01 - 31 */
d2 2. /* mm = 01 - 12 and dd = 01 - 31 */
y2 2. /* yy */
y4 4. /* yyyy */
;
wod=&INITIAL_DT -1;
call symput("wod",wod);
call symput("d2",(put(day(&wod.),z02.)));
call symput("y4",YEAR(wod));
call symput("y2",put(wod,year2.));
call symput("m2",(put(month(&wod.),z02.)));
run;
%PUT &m2. &d2. &y2. &y4. ;
Log Results:
39
40 %PUT &m2. &d2. &y2. &y4. ;
02 28 18 2018
41
Thanks in advance
Elliott
... View more