I am reading in a set of data sets that share a naming convention, but each subsequent data set name has a suffix that is incremented by 1--i.e., tx1, tx2, . . . tx28. Three of the 28 data sets have a variable that is num, when in the rest of the data sets this variable is char. I am trying to make the type consistent before appending these data sets; however, I am getting a SPOOL error.
%macro vartype;
%do i=1 %to 28;
data tx2&i;
set tx&i.;
CASE_CAUSE_NBR2 = trim(left(put(CASE_CAUSE_NBR, 9.);
run;
%end;
%mend vartype;
%vartype;
When I comment out the line that generates the new variable, the code runs successfully; however, when I include it, that's when the error arises . . .
MLOGIC(VARTYPE): %DO loop index variable I is now 28; loop will iterate again.
SYMBOLGEN: Macro variable I resolves to 28
MPRINT(VARTYPE): data tx228;
SYMBOLGEN: Macro variable I resolves to 28
22: LINE and COLUMN cannot be determined.
NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN
where the error has occurred.
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, ), *, **, +, ',', -, /, <, <=,
<>, =, >, ><, >=, AND, EQ, GE, GT, IN, LE, LT, MAX, MIN, NE, NG, NL, NOT, NOTIN, OR, ^,
^=, |, ||, ~, ~=.
76: LINE and COLUMN cannot be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where
the error has occurred.
ERROR 76-322: Syntax error, statement will be ignored.
MPRINT(VARTYPE): set tx28;
MPRINT(VARTYPE): CASE_CAUSE_NBR2 = trim(left(put(CASE_CAUSE_NBR, 9.);
MPRINT(VARTYPE): run;
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.TX228 may be incomplete. When this step was stopped there were 0
observations and 66 variables.
WARNING: Data set WORK.TX228 was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
Any ideas?