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!
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.
Ready to level-up your skills? Choose your own adventure.