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
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
Register now!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for:
View all other training opportunities.