You do not need to resort to %SYSFUNC() to scan since there is a built in macro function %SCAN(). In macro code everything is a string, so there is no need to put quotes around string literals to let the parser know you are representing a string. There is no need to "strip" macro variables. If for some strange reason you have managed to create a macro variable that has leading and/or trailing unquoted spaces then you can use a simple %LET statement to remove them. %let x= a ; is the same as %let x=a; since the unquoted spaces are ignored. It is easier in macro coding if you do not use a comma as your delimiter. proc sql noprint; select udbnum into :firmid separated by '|' from temp ; %let nobs=&sqlobs ; quit; %do i=1 %to &nobs ; %let fid=%scan(&firmid,&i,|) ; ... %end;
... View more