Hello, Long term reader first time poster here in this wonderful community. So the issue I'm having is that when I call a macro from another program using the %include statement and run the macro which will print using the %put statement, the output I get does not appear aligned properly, see below: -------------------------------------
- Values for Current Month -
-Year (YYYY) = 2019 -
-Month (MM) = 07 -
-Month & Year (YYYYMM) = 201907 -
-Month & Year (YYYY-MM) = 2019-07-
-Month & Year (MMMYY) = JUL19 -
------------------------------------- but when running the macro directly from the file containing the macro, it is properly aligned, see below: -------------------------------------
- Values for Current Month -
-Year (YYYY) = 2019 -
-Month (MM) = 07 -
-Month & Year (YYYYMM) = 201907 -
-Month & Year (YYYY-MM) = 2019-07-
-Month & Year (MMMYY) = JUL19 -
------------------------------------- I'd like to set up my macros in a toolbox location which is called using the %include statement in other programs but not suffer from the issue of losing spaces/tabs in the log when printing, can anyone provide some help with this. macro code below: %macro date_list(offset);
%do i = 0 %to 11;
%global yyyymm&i. mmmyy&i. yyyy_mm&i. yyyy&i. mm&i.;
%let yyyy&i. = %sysfunc(intnx(month,%sysfunc(today()),-&offset.-&i.),year.);
%let mm&i. = %sysfunc(putn(%sysfunc(intnx(month,%sysfunc(today()),-&offset.-&i.),month.),z2.));
%let yyyymm&i. = %sysfunc(intnx(month,%sysfunc(today()),-&offset.-&i.),yymmn6.);
%let mmmyy&i. = %sysfunc(intnx(month,%sysfunc(today()),-&offset.-&i.),monyy5.);
%let yyyy_mm&i. = %sysfunc(intnx(month,%sysfunc(today()),-&offset.-&i.),yymmd.);
%end;
data dates;
do i = 0 to 11;
yyyy = put(symget(cats('yyyy',i)),$6.);
mm = put(symget(cats('mm',i)),$2.);
yyyymm = put(symget(cats('yyyymm',i)),$6.);
mmmyy = put(symget(cats('mmmyy',i)),$5.);
yyyy_mm = put(symget(cats('yyyy_mm',i)),$7.);
output;
end;
run;
proc print data = dates;
run;
%put -------------------------------------;
%put - Values for Current Month -;
%put -Year (YYYY) = &yyyy0. -;
%put -Month (MM) = &mm0. -;
%put -Month & Year (YYYYMM) = &yyyymm0. -;
%put -Month & Year (YYYY-MM) = &yyyy_mm0.-;
%put -Month & Year (MMMYY) = &mmmyy0. -;
%put -------------------------------------;
%mend;
/*options nomprint nomlogic;*/
%date_list(0);
... View more