Hello, I am trying to run the following macro code... %macro doranks(types=,models=,list=);
%do t=1 %to %sysfunc(countw(&types));
%let type=%scan(&types,&t);
%do m=1 %to %sysfunc(countw(&models,%str( ),q));
%let model=%scan(&models,&m,%str( ),q));
%do L=1 %to %sysfunc(countw(&list));
%let listitem=%scan(&list,&L);
proc sql;
create table Top5_Rank_&type._&listitem (drop=Rank) as select Rank,
&model as Model,
sum(target) as tot_target,
calculated tot_pct_target/1000 as pct_all_target format percent8.1
from ranked_&type._&listitem
where Rank = 1
group by Rank;
quit;
%end;
%end;
%end;
%mend;
%doranks(types=DT LR RF, models='Decision Tree' 'Logistic Regression' 'Random_Forest', list=w_Enc wo_Enc); ..and I keep getting an error regarding the '&model' macro variable. It seems like the code is adding a parenthesis at the end of the character value that I am trying to assign to the new column. Here is the part of the error log message that shows this: NOTE: Line generated by the macro variable "MODEL". 130 'Decision Tree') - 22 200 ERROR 22-322: Syntax error, expecting one of the following: a quoted string, !, !!, &, *, **, +, ',', -, /, <, <=, <>, =, >, >=, ?, AND, AS, BETWEEN, CONTAINS, EQ, EQT, FORMAT, FROM, GE, GET, GT, GTT, IN, INFORMAT, INTO, IS, LABEL, LE, LEN, LENGTH, LET, LIKE, LT, LTT, NE, NET, NOT, NOTIN, OR, TRANSCODE, ^, ^=, |, ||, ~, ~=. ERROR 200-322: The symbol is not recognized and will be ignored. I would like the code to assign the values found in the 'models' list in the %doranks macro statement into the new 'Model' column created in the proc sql code.
... View more