You would do better to use CALL SYMPUTX instead of CALL SYMPUT. That way, the softtware automatically removes leading and trailing blanks from the macro variable it creates. Even if you get the %PUT statement to execute the way you intend, it won't necessarily show leading and trailing blanks.
%PUT statements are never part of a DATA step. You could easily use a PUT statement:
put path;
To use %PUT you would need to jump through quite a few hoops: find out the number of paths in your data set, write a macro loop that goes through a DATA step reading just one observation, then executes %put. If that's worth it, we can look at some details.
One final thought about a trick that may work: try changing the %PUT statement to read:
call execute('%put &file;');
CALL EXECUTE will execute macro statements immediately, so may be able to track the current value of &FILE.
Update: Confirmed that the last idea above does actually work.
... View more