Hi, Is there a better way to concatenate all these variables that starting with a variable name var and a value attached?
Eg.
var1
var2
var3
var4
var5
This is what I got now, but would pick up variables like var_ which not needed.
var_conc= catx(',', of var:);
Thanks
Provided, that your posted data is representable, you could do
data have;
input (var1 var_1 var2 var_2 var3 var_3)($);
datalines;
a b c d e f
;
data want;
set have;
var_conc = catx(',', of var1-var3);
run;
Why do you change your question half-way?
What exactly do you want? To keep the SKILL: variables but not the SKILL_: variables?
Show us the proc contents of your table, and describe exactly what you want to concatenate.
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.