Thanks Tom for your quick response!
I plugged in your code and SAS spit out error saying "do loop is not valid in open code", please see below:
data base;
27 set %do offset=0 %to %sysfunc(intck(month,&mob.,&moe.));
ERROR: The %DO statement is not valid in open code.
28 lcmf.cm%sysfunc(intnx(month,&mob.,&offset),yymmn6.)
WARNING: Apparent symbolic reference OFFSET not resolved.
WARNING: Apparent symbolic reference OFFSET not resolved.
ERROR: Argument 3 to function INTNX referenced by the %SYSFUNC or %QSYSFUNC macro function is not a number.
ERROR: Invalid arguments detected in %SYSCALL, %SYSFUNC, or %QSYSFUNC argument list. Execution of %SYSCALL statement or %SYSFUNC
or %QSYSFUNC function reference is terminated.
29 %end;
ERROR: The %END statement is not valid in open code.
NOTE 139-205: Line generated by the macro function "SYSFUNC".
28 lcmf.cm.
________
22
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, ;, CUROBS, END, INDSNAME, KEY, KEYRESET, KEYS,
NOBS, OPEN, POINT, _DATA_, _LAST_, _NULL_.
NOTE: Line generated by the macro function "SYSFUNC".
28 lcmf.cm.
________
201
ERROR 201-322: The option is not recognized and will be ignored.
30 ;
31 run;
and my code is as below, I only added the libname prefix "lcmf"
%let mob=%sysfunc(intnx(month,%sysfunc(today()),-16,B));
%let moe=%sysfunc(intnx(month,%sysfunc(today()),-5,E));
%put &mob.;
%put &moe.;
data base;
set %do offset=0 %to %sysfunc(intck(month,&mob.,&moe.));
lcmf.cm%sysfunc(intnx(month,&mob.,&offset),yymmn6.)
%end;
;
run;
Any idea of what may go wrong?
Thanks again!
... View more