Dear Stata users,
I have data in long format with dates of specific events for each unique identifier. The goal is to try and calculate duration between some events. Below is an example of data
* Example generated by -dataex-. For more info, type help dataex
clear
input float(ID step) int date
101 100 20577
101 200 20682
101 300 20759
101 400 20767
101 700 21947
102 200 20361
102 300 20445
102 400 20577
102 500 20682
102 700 20759
103 100 20767
103 200 21945
103 300 21054
103 400 21059
103 500 21101
103 600 21131
103 700 21145
104 100 21166
104 200 21549
104 300 21153
104 400 21157
104 500 21159
104 600 21161
104 700 21165
105 100 21165
105 300 21585
105 400 21527
105 500 21528
105 600 21529
105 700 21530
end
format %tdnn/dd/CCYY date
[/CODE]
ID is the unique identifier, Step is the event and date is the date when the event occurred.
I would like for example to calculate the duration between step 100 - 500, 200 - 700.
Notably, not all unique IDs have all steps. There's a possibility of some IDs not having some steps.
Thanks in advance!
Related Posts with Calculating durations by ID
Regression results: omitted standard errors and other statisticsHi Everyone, I am trying to estimate the impact of a policy on an outcome that contains 17% zeros (…
Mixed Models - considering time in the interaction term (timepoint##intervention) as continuous or dummyDear Statlisters, I am analysing the data from an medical intervention in a pilot study with 29 ind…
Multi-response variablesHello, I would like to calculate how the overall prevalence rates of different health conditions ha…
Fixed effects in -xtpcse-Hello everyone, I'm running an analysis with TSCS data and test statistics reveal the presence of a…
RDD with categorical outcome variableI am just wondering if there is anyone out there able to perform rdrobust with categorical outcome v…
Subscribe to:
Post Comments (Atom)
0 Response to Calculating durations by ID
Post a Comment