I have no idea how to solve this problem. Could anyone help me to debug? thanks.
code:
%macro rmhistory( t);
proc import datafile="D:\Users\emma\Documents\DDS\RMTable\file.txt" out=file replace;
run;
DATA rm_all;
RUN;
%do i=1 %to &t;
data _null_;
set file;
if _n_=&i then do;
call symput('ss', aa);
end;
run;
%put &ss &i;
proc import datafile="D:\Users\emma\Documents\DDS\RMTable\&ss" out=rm&i replace;
SHEET="RMTable";
run;
data rmyyyymm&i;
set rm&i;
FORMAT yyyymm $6.;
yyyymm = substr(&ss,1,6);
run;
data rm_all;
set rm_all rmyyyymm&i;
run;
%end;
%mend rmhistory;
%rmhistory(1);
error message:
MPRINT(RMHISTORY): data rmyyyymm1;
MPRINT(RMHISTORY): set rm1;
MPRINT(RMHISTORY): FORMAT yyyymm $6.;
NOTE: Line generated by the macro variable "SS".
1 201801_RMTableV1.xlsx
---------------
22
557
ERROR: DATA STEP Component Object failure. Aborted during the COMPILATION phase.
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, *, **, +, ',', -, /, <, <=, <>, =, >, ><,
>=, AND, EQ, GE, GT, LE, LT, MAX, MIN, NE, NG, NL, OR, ^=, |, ||, ~=.
ERROR 557-185: Variable _RMTableV1 is not an object.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
cpu time 0.00 seconds
MPRINT(RMHISTORY): yyyymm = substr(201801_RMTableV1.xlsx,1 ,6);
MPRINT(RMHISTORY): run;
MPRINT(RMHISTORY): data rm_all;
MPRINT(RMHISTORY): set rm_all rmyyyymm1;
MPRINT(RMHISTORY): run;