Hi,
I am new to Stata, so I am not very familiar with the codes. I have a dataset with multiple variables. For each subject, they have multiple visits. I am interested in people that showed a variable x score >0 at 2 time points a year apart. Because they have multiple visits, there are individuals who could show variable x score >0 at year 1, 2, 3, 4 OR at year 2,3 OR 2,4 . I want to track the first 2 time point that they scored >0 without dropping the other visits. How could I proceed with this?
An example of my data set:
patientID_all visit_num variable x ID_metcriteria
1 1 2 1
1 2 1 1
1 3 0
1 4 0
2 1 0
2 2 3 2
2 3 2 2
2 4 3
3 1 0
3 2 0
4 1 0
4 2 2
4 3 0
4 4 3
Apologies, if my question is a little confusing.
Related Posts with Generating a variable that tracks the first time 2 IDs appear simultaneously
Summary stats with panel data: obtaining both N (overall obs.) and n (group obs.) by ethnic groupsDear all, I am trying to do some simple mean summary statistics for each variable with panel data (…
reshape / transpose large dataset for mergingI am constructing a large timeseries dataset, with cases arranged around WDI_code (World Development…
cannot compute an improvement -- discontinuous region encounteredI am trying to build a multilevel model with the governrate-level indicators, but I get this problem…
How to repeat some command linesHello all, I need to repeat 3 line of commands in stata to create updated observations for three va…
How to loop element-by-element operations (e.g regression)Hello, I am trying to find a way to loop element by element operations across two lists of variables…
Subscribe to:
Post Comments (Atom)
0 Response to Generating a variable that tracks the first time 2 IDs appear simultaneously
Post a Comment