Log
668 %macro date_loop(start,end);
669 %let start=%sysfunc(inputn(&start,anydtdte9.));
670 %let end=%sysfunc(inputn(&end,anydtdte9.));
671 %let dif=%sysfunc(intck(month,&start,&end));
672 %do i=0 %to &dif
673 %let date=%sysfunc(intnx(month,&start,&i,b),date9.);
674 %put &date;
675 %end;
676 %mend date_loop;
677
678 %date_loop(01jul2015,01feb2016)
01JUL2015
01AUG2015
01SEP2015
01OCT2015
01NOV2015
01DEC2015
01JAN2016
01FEB2016
Example 12: Using Macro Variables within a
CARDS or DATALINES Statement
Details
Macro variables are not allowed within the CARDS or DATALINES statements. This
example shows a trick that uses the RESOLVE function to avoid this limitation.
Program
%let dog=Golden Retriever;
data example;
input text $40.;
textresolved=dequote(resolve(quote(text)));
datalines;
John's &dog
My &dog is a female
That's Amy's &dog puppy
;
proc print;
run;
Program Description
Create a macro variable named &DOG to reference within DATALINES.
%let dog=Golden Retriever;
Example 12: Using Macro Variables within a CARDS or DATALINES Statement 469
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset