04-02-2015 06:34 PM
Hi I have the below data for 400K customers (1 row per customer with a different combination for each customer).
I want to end up with two columns like below. Any ideas the best way to do this. thanks
04-02-2015 06:45 PM
data want (keep=ID combination);
array f flag: ;
do j=1 to dim(f);
combination = f
if not missing(combination) then output;
might do the trick
04-02-2015 06:51 PM
Proc transpose would work too:
proc transpose data=have out=want (drop=_:
04-03-2015 05:23 PM
Thanks for the reply. I tried doing:
Proc transpose data=old out=new;
var flag_1 flag_2 flag_3 flag_4 flag_5 flag_6 flag_7 flag_8 flag_9 flag_10 flag_11 flag_12;
but i ended up with 2 columns, so id col1 col2. I'm not sure why, Any ideas? Sorry I am new to this all.
04-03-2015 05:36 PM
Are you sure that the extra column wasn't one labeled '_name_' ? I dropped that one with the code I had suggested, as renamed col1 to be combination (like you did in your example).
The only things you had to change in the code I suggested were the dataset names, old rather than have, and new rather than want.