10-11-2017 07:33 AM - edited 10-11-2017 07:39 AM
Below is the code which i am using but i want to replace proc tranpose with either proc sql or arrays as i need to sort avalc with aval to sort as per aval.
proc sort data=Anl1 out=anl2; by subjid paramcd aval; run; data Id_adds (keep=subjid aval avalc paramcd seq); set anl2; by subjid paramcd aval; seq+1; if first.paramcd then seq=1; run; proc transpose data=Id_adds out=Id_trans(drop=_name_ _label_) ; by subjid; id paramcd seq; var avalc; run;
10-11-2017 07:49 AM
"..as i need to sort avalc with aval to sort as per aval..."
Maybe above will make sense to someone; it doesn't to me.
As for alternatives to Proc Transpose the following should be a quite good starting point:
10-11-2017 07:55 AM
If you want help in the form of code then you need to provide sample data (a working SAS datastep creating such data) and then show us the desired result based on the sample data.
10-11-2017 08:09 AM
10-11-2017 08:12 AM
Please provide a sample/show us how the desired output should look like. This might be very obvious to you but it's not to me and I don't want to spend time and effort on something which doesn't return what you're after.
10-11-2017 08:35 AM - edited 10-11-2017 08:39 AM
Looking at the data and code you've now provided again: May be below gives you what you're after.
proc transpose data=Id_adds out=Id_trans(drop=_:); by subjid; id paramcd seq; var avalc; run; proc sql; create table want as select idt.*, l.aval from id_trans as idt left join (select subjid, aval, avalc from anl2) as l on idt.subjid=l.subjid order by l.aval, idt.subjid ; quit;