Dear all,
I have a dataset that has multiple visits for each person. However each person had a differing number of visits
The dataset is demonstrated below
id visit value
1 1 70
1 2 70
1 3 68
1 4 58
2 1 55
2 2 35
3 1 57
4 1 67
4 2 55
5 1 59
5 2 52
5 3 32
I had a few queries to working on this dataset
1. Is there a command that would allow me to identify:
a) the visit with the lowest value for each id (i.e visit 1 for
b) the value corresponding to the last visit (i.e visit 4 for id 1, visit 3 for id 5) for each id
c) the change and direction of change between the highest and lowest value for each id (i.e for visit 5, the change would be negative 27 over 3 visits)
2. After establishing the above,
Is there a command that would
a) allow me to drop the other visits apart from the desired visit in question - be it the visit with the lowest value, last visit,
b) such that the dataset becomes one visit per id?
I would be grateful for your help with these queries.
Thank you very much
Related Posts with How to sort data for distinct IDs with multiple visits and multiple values
How to assess quality of PSMATCH2 matching result in matching within strata?Dear Statalist users, I have been digging previous posts regarding my problem and do not seem to fi…
Matching two datasetsHi, I have one dataset with 33 observations where I have three geographical variables: state which…
Saving multiple simulated data using foreach commandDear all, I am a newbie in a simulation study. Here I created one simulated data using foreach comm…
Translating ice to mi impute and a not positive definite VCEHi all I'm trying to update some imputation code that currently is written using ice to mi impute (…
effect sizes and multilevel modelsHi all, I am running the below mixed effects model. Code: mixed outcome indeps || _all: R.rater…
Subscribe to:
Post Comments (Atom)
0 Response to How to sort data for distinct IDs with multiple visits and multiple values
Post a Comment