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.
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 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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: