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.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: