This issue is that you generated this code:
college="A&S"
But there was no S macro variable found.
To avoid the macro processor examining the values embed the strings in single quotes, not double quotes. You can include the quotes into the value of the macro variables you generate by using the QUOTE() function in your SQL query.
%macro cagoal;
%local i;
proc sql noprint;
select distinct
quote(trim(college),"'")
, quote(cats("&path\",Global_College,"_Goals.xlsx"),"'")
into :college1-
, :Global_College1-
from caa.usf_college_sort
;
quit;
%do i=1 %to &sqlobs;
proc export dbms=xlsx replace
data=caa.usf_college_sort
(
where=(college=&&college&i)
keep=college global_college cohort_yr usf_pell_6yr_actual
Pell_6YR_Actual Pell_6YR_Forecast l95 u95
)
outfile=&&Global_College&i
;
run;
%end;
%mend cagoal;
... View more