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
Probem with using global macro in a string before an underscoreHi statalisters, I want to use global macro's to refer to folder names, but ran into some unexpecte…
How to Set Quarterly DataI am trying to do some VAR analysis, but I can't get the tsset correct, because of how the data in t…
The best model for a multilevel dataset with a small number of clustersDear all, I have a three-level cross-country survey data that is not panel. The levels are country…
Latent Class Analysis: Vermunt 3-step procedure for estimating distributions of external variables?Has anyone implemented, or know of an approach, to implementing the 3-step ML method for estimating …
Survival analysis using flexible parametric models to account for time-varying hazards (stpm2)Dear Statalisters, My question relates to survival analysis in the presence of time-varying hazards…
Subscribe to:
Post Comments (Atom)
0 Response to How to sort data for distinct IDs with multiple visits and multiple values
Post a Comment