The SID List was referring to the list of values as in "I know that when entered by the prompt, the variables become SID1, SID2, SID3". I assumed this was a list. If it is not then:
%macro MyLoop (sid);
proc sql;
title "&SID. Report";
select StoreName, StoreRevenue
from Store_Data_Set
where StoreID="&SID.";
quit;
title;
%mend MyLoop;
data _null_;
call execute('%MyLoop(SID);');
do i=2 to &SID_Count.;
call execute(cats('%MyLoop(SID',i,');'));
i=i+1;
end;
run;
Although I dont understand why you are doing it this way in the first place. Surely you can just use a proc report with a by statement and a datastep (this is unchecked as not at work):
data report_data;
set have (where=(storeid in (<the list of variables>));
run;
proc report data=report_data;
by storeid;
title "This is for store id #byval1";
columns _all_;
...
run;
No need for macros or sql?
... View more