Hi,
I need something similar to this, but I would like only UNIQUE Values populated into my new string variable.
What I'm doing is Transposing some information and then srunching all of that items into one variable. I have written a macro to do this, but I can get multiple items sent to my new string variable.
I have added a duplicate record in the datalines. (11 in line 1 and 99 in line 2)
How would I code it so that these duplicated items were only listed once?
data fakedata;
** Vars a1-a5 are character;
** vars n1-n5 are numeric;
length a1 $2 a2 $3 a3 $1 a4 $5 a5 $2;
infile datalines;
input a1 a2 a3 a4 a5 n1 n2 n3 n4 n5;
return;
datalines;
aa xyz q bbbbb tt 11 22 11 44 55
bb xyz r ccccc uu 99 88 99 66 55
;
run;
data cmbcol;
length A N $1000 A_oth N_oth $1000;
set fakedata;
A_oth = catx(',',a1,a2,a3,a4,a5);
N_oth = catx(',',put(n1, best8.),put(n2, best8.),
put(n3, best8.), put(n4, best8.),put(n5, best8.));
run;
proc print data=cmbcol;
title 'concatenate separate variables into one big variable';
run;
... View more