BookmarkSubscribeRSS Feed
Ksharp
Super User

Jaap has already given you answer:

call symputx('file'||put(_n_,8. -L ),filenames,'G');

jakarman
Barite | Level 11

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.))

---->-- ja karman --<-----
JakeElwood
Calcite | Level 5

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.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 17 replies
  • 13763 views
  • 1 like
  • 10 in conversation