BookmarkSubscribeRSS Feed
aarony
Obsidian | Level 7

thank you very much for reading this.

my data looks like this

yr name      strength_a strength_b    strength_c     strength_d class

1991 john            2 1 0 0 a

1991 amy           1 0 2 1 a  

1991 ted             0 2 1 1 b

1991 tom           2 2 0 0 b

1992 john            2 1 0 0 a

1992 amy           1 0 2 1 a  

1992 ted             0 2 1 1 b

1992 tom           2 2 0 0 b

my years are from 1991 to 2012 and i have more observations than the above but i just wanted to give you a picture. my scores range from 0~2.

I want to arrive at the format below:

Yr         name    varname            score    class

1991     john      strength_a 2          a

1991     john      strength_b 1          a

1991     john      strength_c 0          a

1991     john      strength_d 0          a

1991     amy      strength_a 1          a

1991     amy      strength_b 0          a

1991     amy      strength_c 2          a

1991     amy      strength_d 1          a

Could you kindly provde me of your guidance?

1 REPLY 1
Scott_Mitchell
Quartz | Level 8

Perhaps you could consider the TRANSPOSE procedure.

PROC SORT DATA=HAVE;

  BY YR NAME CLASS;

RUN;

PROC TRANSPOSE DATA=HAVE OUT=WANT(RENAME=(COL1 = SCORE _NAME_ = VARNAME));

  BY YR NAME CLASS;

RUN;

sas-innovate-2024.png

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!

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
  • 608 views
  • 0 likes
  • 2 in conversation