BookmarkSubscribeRSS Feed
COLDORANGE
Calcite | Level 5

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

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

I used array statement and proc transpose

but I can't repeat time variable beside temp.

Please Help me.

1 REPLY 1
Chrishi
Calcite | Level 5

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;

run;

proc sort data=final;

by X;

run;

Sudeer  

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 632 views
  • 1 like
  • 2 in conversation