Hi. I need help creating a variable based on the same variable data from a different row. Basically it's a table of patient identifiers who have had their weight taken many different times. Each new reading is a new row. Some patients have more rows than others because they have had more readings. I want to move the BP from the second reading on to the first row, so it is concise.
How it is now:
PATIENT ID |
DATE |
WEIGHT (lbs) |
1 |
1/1/2021 |
150 |
1 |
2/1/2021 |
160 |
1 |
3/1/2021 |
152 |
1 |
4/1/2021 |
157 |
2 |
2/15/2021 |
120 |
2 |
5/10/2021 |
123 |
3 |
1/15/2021 |
180 |
What I want:
PATIENT ID |
DATE1 |
WEIGHT1 |
DATE2 |
WEIGHT2 |
DATE3 |
WEIGHT3 |
DATE4 |
WEIGHT4 |
1 |
1/1/2021 |
150 |
2/1/2021 |
160 |
3/1/2021 |
152 |
4/1/2021 |
157 |
2 |
2/15/2021 |
120 |
5/10/2021 |
123 |
|
|
|
|
3 |
1/15/2021 |
180 |
|
|
|
|
|
|
Is this possible?? If so, how can I do it?
0 Response to Variable creation based on same variable
Post a Comment