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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—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
  • 16368 views
  • 1 like
  • 10 in conversation