Dear All:
May I ask how to transform the following have table to the want table right below?
HAVE table:
patient | tcell_[year1] | tcell_[year2] | tcell_[year3] | tcell_[year4] | tcell_[year5] |
---|---|---|---|---|---|
A | 23 | 34 | 213 | 45 | 435 |
C | 132 | 213 | 123 | 345 | 435 |
D | 13 | 123 | 123 | 435 | 123 |
E | 343 | 1231 | 4325 | 435 | 345 |
WANT table:
patient | year | tcell |
---|---|---|
A | 1 | 23 |
A | 2 | 34 |
A | 3 | 213 |
A | 4 | 45 |
A | 5 | 435 |
C | 1 | 132 |
C | 2 | 213 |
C | 3 | 123 |
D | 1 | 13 |
D | 2 | 123 |
D | 3 | 123 |
Use Proc Transpose:
SAS Learning Module: How to reshape data wide to long using proc transpose
Thank you so much, this work!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.