I have raw data like this
time ID01 ID02 ID03 ~ IDxx 0 10 11 xx 0.5 20 12 xx 1 29 25 xx 1.5 41 30 xx 2 50 40 xx 3 30 50 xx 4 40 42 xx
time ID01 ID02 ID03 ~ IDxx
0 10 11 xx
0.5 20 12 xx
1 29 25 xx
1.5 41 30 xx
2 50 40 xx
3 30 50 xx
4 40 42 xx
I want to make it to this form
x time temp. 01 0 10 01 0.5 20 01 1 29 01 1.5 41 01 2 50 01 3 30 01 4 40 02 0 11 02 0.5 12 02 1 25 02 1.5 30 02 2 40 02 3 50 02 4 42
x time temp.
01 0 10
01 0.5 20
01 1 29
01 1.5 41
01 2 50
01 3 30
01 4 40
02 0 11
02 0.5 12
02 1 25
02 1.5 30
02 2 40
02 3 50
02 4 42
I used array statement and proc transpose
but I can't repeat time variable beside temp.
Please Help me.
Hi, hope below code will solve your problem.
proc transpose data=want out=have;
by time;
var ID01 - IDXX;
run;
data final;
set have;
X=substr(_name_,3);
drop _name_;
rename col1=temp;
proc sort data=final;
by X;
Sudeer
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Latest Updates
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.
Browse our catalog!