BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Xiaoningdemao
Quartz | Level 8

Dear All,

 

i have the following data

 

ID height
1 150
1 155
1 157
2 160
3 170
3 171

these are the repeated measure of height;

 

what i want is:

ID height_1   height_2   height_3
1 150            155           157
2 160
3 170            171

 

Other than height, i have many other measurements, and i don't know how many repeats there is, different measurements may have different number of repeats.

 

Thank you so much in advance!!!

 

Best wishes.

 

 

1 ACCEPTED SOLUTION
5 REPLIES 5
Xiaoningdemao
Quartz | Level 8

the approach i want to resolve this issue, is to use proc transpose, but i need a variable to count the repeats, i have trouble formulate variable "repeats";

ID height   repeats
1 150         1
1 155         2
1 157         3
2 160         1
3 170         1
3 171         2

 

any thought on this?

 

Thanks!!!!

ballardw
Super User

@Xiaoningdemao wrote:

the approach i want to resolve this issue, is to use proc transpose, but i need a variable to count the repeats, i have trouble formulate variable "repeats";

ID height   repeats
1 150         1
1 155         2
1 157         3
2 160         1
3 170         1
3 171         2

 

any thought on this?

 

Thanks!!!!


What is the expected output for this example considering your "repeats"?

 

Also, what may you be doing with the resulting data set?

Reeza
Super User
This is a tutorial on creating an enumerating variable.

Xiaoningdemao
Quartz | Level 8
exactly what i want!!!!
Thank you so much Reeza.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1817 views
  • 2 likes
  • 3 in conversation