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!
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.
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.