The below macro variable a will get a,b,c,d; may I know how to get a.a, a.b, a.c, a.d?
data test;
infile datalines dsd;
input a1 $ a2 $ a3 $ a4 $;
cards;
a,b,c,d
;
run;
data test;
set test;
call symputx("a",catx(",",of a: ));
run;
%put &a;
data test;
infile datalines dsd;
input a1 $ a2 $ a3 $ a4 $;
call symputx("a",cats("a.",catx(",a.",of a:)));
cards;
a,b,c,d
;
run;
%put &a.;
The question really is why you would be wanting to do that in the first place.
@scb wrote:
The below macro variable a will get a,b,c,d; may I know how to get a.a, a.b, a.c, a.d?
data test;
infile datalines dsd;
input a1 $ a2 $ a3 $ a4 $;
cards;
a,b,c,d
;
run;
data test;
set test;
call symputx("a",catx(",",of a: ));
run;
%put &a;
You really do not want to do that as a.a is not a valid SAS variable name in general and the . would have SAS report some sort of SCL error. You could make date name literals but you would have to reference the resulting variable as 'a.a'n every time you use it.
So explain why you think you want a.a , a.b etc.
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!
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.