This is more of a question about the general understanding of how SAS processes procedures as I did develop a work around to this problem. Here is the code below: %macro runrpt_all(nRun,dataset); %do z=1 %to &nRun; data _null_; set work.&dataset; if _n_ = &z then do; call symput('as_grp',trim(assess_Grp)); call symput('lbl_1',trim(label_1)); call symput('lbl_2',trim(label_2)); call symput('lbl_3',trim(label_3)); call symput('level',trim(lvl)); end; run; %runrpt(&as_grp,%str(&lbl_1),%str(&lbl_2),&level,&lbl_3); dm "ODSRESULTS;CLEAR";dm 'CLEAR LOG;CLEAR OUTPUT;'; %end; %put EXIT; %mend runrpt_all; Here is the situation. The code above was created in order to automate a process to run the macro "%runrpt" instead of having many "%runrpt" macro statements and adjusting them each program run. Within the dataset, Label_1 (&lbl_1) and Label_2 (&lbl_2) has instances of commas in their data. The "%runrpt" macro takes 4 variables in, so the commas would pose an issue. In order to resolve that case, the manual method used the %str() macro to encapsulate the manually inputted string that contained commas. So I decided to replicate the same method, hence why you see %str(&lbl_1) and %str(&lbl_2). However, doing that produced the very error I was trying to avoid; detection of too many parameters passed in. So my question is, how does SAS process a %str() statement with a macro-variable inside. Again, under the manual method of placing %str(string,with,commas), the macro will run fine. Once I switch it to using a macro variable, I get the error regarding too many parameters detected. My work-around is as follows: data _null_; set work.&dataset; if _n_ = &z then do; call symput('as_grp',trim(assess_Grp)); call symput('lbl_1',cats('%str(',label_1,')')); call symput('lbl_2',cats('%str(',label_2,')')); call symput('lbl_3',trim(label_3)); call symput('level',trim(lvl)); end; run; %runrpt(&as_grp,&lbl_1,&lbl_2,&level,&lbl_3); Thanks for any help to answer this question
... View more