In your %let statement below:
%let var= %scan(&make,&i,"@");
There is a difference between macro %scan and scan. The delimiter in %scan should be exactly what it is in the macro variable value without quotes if you don't want the quotes as part of the delimiter. For example if your macro variable make equaled something like: One@Two@Three and you specify "@" as your delimiter it won't actually see three words because the delimiter "@" doesn't appear in the macro text. Instead you can try:
%let var= %scan(&make,&i,@);
I don't know the value of your MAKE macro variable, but this is one potential issue that came to mind.
I would change your loop code to this:
%macro a;
%do i=1 %to &n;
%let var= %scan(&make,&i,@);
proc export data=testing (where=(make="&var."))
outfile="C:\Users\&var..xlsx"
dbms=xlsx replace;
sheet="&var." ;
run;
%end;
%mend ;
%a;
Since I think you're trying to use that scanned value as the name instead of the whole macro variable. The macro variable VAR holds the value from the %scan.
... View more