Hi everybody, I'm so sorry to bother you.
I have the following dataset:
ID ammission_date dismission_date
1 07sep2019 09sep2019
1 15 sep2019 28sep2019
2 9mar2020 10mar2020
3 6june2020 8june2020
3 8may2020 10 may2020
3 1jan2020 21jan2020
...
I need to calculate if the distance between first dismission date and second ammission date (and between the second dismission date and the third ammission date and so on) is <=7 for repeted observations.
I thought of first sorting the ammission dates, then the ID (which in my dataset is not sorted) and then to reshape wide in order to calculate the distance by row. This doesn't work properly because the new vars I get with the reshape wide are not sorted (ammission_date1 could be further thant ammission_date2). Have you any idea of how can I do? Thank you a lot!
Martina
Related Posts with Sorting and reshaping: can't get the right order
Intersection among datasetsHi all, so I have k databases (55) called name_country_mole.dta. Each database is an unbalanced pan…
ForecastingI have been using STATA to do some forecasting on stock market data. When I generate the forecasts a…
xtlogit with one dummy predictorHello all, I have been looking for days for an answer to this question, but have not found an answe…
No observations r(2000)Dear everyone, I am working on my masters thesis and I am trying to make a twostep system gmm regre…
enquiry about using likelihood ratio test when employing conditional logistics regression !Hello, I am testing a categorical variable (ethnicity) with a binary outcome (death). I want to obta…
Subscribe to:
Post Comments (Atom)
0 Response to Sorting and reshaping: can't get the right order
Post a Comment