Dear Sir/Madam,
I have this longitudinal that, I want to reduce to cross-sectional data.
If Lmin and Rmin are present together with ICU LOS Age we keep this row and delete all other rows for this id.
If Lmin and Rmin are present but not any of ICU LOS Age , we keep the values, that is the first time they are recorded.
If Lmin and Rmin are not recorded but ICU LOS Age are recorded, we keep the values recorded to fit where missing.
If Lmin and Rmin are not recorded together with ICU LOS Age we delete (he data has other additional variables.
To summarize, for each person, use the first recorded value of Lmin, Rmin, ICU, LOS and age and drop the rest.
Below is an example of the longitudinal data and newly created cross sectional data.
id Lmin Rmin ICU LOS Age
1 2 5 19
1 1 2
1 1
2 1 5
2 2 5 6 27
2 1 2
2 2
New Data to be created
Id Lmin Rmin ICU LOS Age
1 1 2 2 5 19
2 1 2 5 6 27
... View more