data al;
input a;
cards;
11
12
13
14
15
16
17
18
19
20
21
22
23
run;
data _null_;
set al;
call symputx("n"||put(_N_,1.),a);
run;
1) can someone try it by above code to resolve macro variable and errors?
2) I think it error becoz of in function length.
3) Please try it only in using above code and got it using SQL...
ERROR: Symbolic variable name N* must contain only letters, digits, and underscores.
NOTE: Argument 1 to function SYMPUTX('n*',20) at line 310 column 6 is invalid.
a=20 _ERROR_=1 _N_=10
ERROR: Symbolic variable name N* must contain only letters, digits, and underscores.
NOTE: Argument 1 to function SYMPUTX('n*',21) at line 310 column 6 is invalid.
a=21 _ERROR_=1 _N_=11
Format 1. cannot accomodate numbers > 9. Try:
data _null_;
set al;
call symputx(cats("n", _N_), a);
run;
Format 1. cannot accomodate numbers > 9. Try:
data _null_;
set al;
call symputx(cats("n", _N_), a);
run;
Aside from the format error, it is usually not necessary to keep numbered lists of macro variables, as code can be created right off the dataset with call execute().
April 27 – 30 | Gaylord Texan | Grapevine, Texas
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!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.