Avi
Missed how col_ind really works.
Still: With the change you made you would get a unique composite key.
But let's assume you need the data horizontal.
I believe the following should do without creating too many unnecessary variables:
data sample;
infile datalines dsd truncover;
input id N_ValuePairs @;
do i=1 to N_ValuePairs;
input Col_Ind @;
do name='x','y';
input Value_Var @;
Name_Var=cats(name,'_',Col_Ind);
output;
end;
end;
keep id name_var value_var;
datalines;
1, 2,23,4,5,24,6,7
2, 3, 234,2,6,712,8,4,1025,10,3
3, 1,23,14,15
;
run;
proc transpose data=sample out=sample(drop=_name_) ;
by id;
id Name_Var;
var Value_VAR;
run;
proc print data=sample noobs;
run;
HTH
Patrick
... View more