index_admit | patient_id | afib | newafib | varnewafib |
1 | 001 | 0 | 0 | 1 |
0 | 001 | 1 | 1 | 0 |
0 | 001 | 1 | 0 | 0 |
0 | 001 | 1 | 0 | 0 |
1 | 002 | 0 | 0 | 1 |
0 | 002 | 0 | 0 | 0 |
0 | 002 | 1 | 1 | 0 |
1 | 003 | 0 | 0 | 0 |
0 | 003 | 0 | 0 | 0 |
1 | 004 | 0 | 0 | 0 |
1 | 005 | 1 | 0 | 0 |
0 | 005 | 1 | 0 | 0 |
I have a dataset as given above where each row represents a hospital visit. The index_admit signifies the first admission for the patient. The afib variable is available. However I will like to obtain newafib and varnewafib. newafib is a variable that tells that if the patient has new afib that was not present on index hospitalization but was present afterwards. The varnewafib provides the value of 1 if a patient had "newafib" during the subsequent admission but it is given in the row where index_admit is 1.
I will really appreciate it.
Thanks.
0 Response to How to identify variable in various rows
Post a Comment