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
Panel data gaps and minimum number of observationsDear Statalisters, I am currently working on my Master Thesis and thus I analyze company financials…
To transform cross-section data to panel dataDear Sir/Madam, I am doing the research on commercial jet aircraft, and each sample has "lease star…
Storing coefficients when running same regression for different sampleDear Statalisters; I need to run the same regression for 5000 different samples. I have a separate …
Facing problem in analyzing unbalanced panel data / using gmm both system and differenceHi dear all i am getting the below error of not sorting of data before running gmm...can you share w…
rlaplace(m,b) command not workingHi, I would like to generate a random variable according to the laplace distribution. The command '…
Subscribe to:
Post Comments (Atom)
0 Response to How to sort data for distinct IDs with multiple visits and multiple values
Post a Comment