Jaap has already given you answer:
call symputx('file'||put(_n_,8. -L ),filenames,'G');
saskiwi already made the remark you will get a problem at the 10-th value.
The issue is putting a numeric will add blanks or zero-s to get postions filled. An REXX stem or SAS macro array is based on numbers not being adjusted.
Correct the adjustment to follow sas-macro conventions. I think 10.000 files as limit will do (4 positions).
call symputx('file'||put(_n_,1.),filenames,'G');
TRIM(LEFT(PUT(_n_,4.))
The original code cannot import any .xls files and gives me the following error. All filenames are .xls with only letters, digits, and underscores:
316
317 data _null_;
318 set file;
319 call symputx('file'||put(_n_,1.),filenames,'G');
320 run;
ERROR: Symbolic variable name FILE* must contain only letters, digits, and underscores.
NOTE: Argument 1 to function SYMPUTX at line 319 column 6 is invalid.
filenames=M:\LS\Data\BannerMerge\FilesGrade350_201 _ERROR_=1 _N_=10
ERROR: Symbolic variable name FILE* must contain only letters, digits, and underscores.
NOTE: Argument 1 to function SYMPUTX at line 319 column 6 is invalid.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.