proc sort data=raw out=temp1;
by id;
run;
data temp2;
set temp1(drop=no name rename=(var1=var1n var3=var3n));
by id;
retain n;
if first.id then n=0;
n+1;
var1=put(var1n,8.);
var3=put(var3n,mmddyy8.);
drop var1n var3n;
run;
proc sort data=temp2 out=temp2;
by id n;
run;
data temp3;
length id 8 varn varv $8;
set temp2;
by id n;
if first.n then varv=' ';
varv=var1;varn=catx('_','var1',n);output;
varv=var2;varn=catx('_','var2',n);output;
varv=var3;varn=catx('_','var3',n);output;
drop n var1-var3;
run;
proc transpose data=temp3 out=oneper;
by id;
id varn;
var varv;
run;
|