Hi all,
I've got a question regarding replacing values of variables with values from subsequent observations.
Let me make my point clearer by showing you the data example.
I have a panel data on inpatients and data goes like this...
Array
As you can see from the highlighted yellow observations, when the inpatient is still in the hopsital at the time of the survey, day of the end_date is recorded as 55.
You can see that the end date of 4th observation is equal to start_date of 5th observation. So the patient actually stayed at the hospital from 2016-10-05 to 2017-04-22.
I want to sort of merge obs no.4 and obs no.5. so that I can work on the data that goes like this...
Array
The question is whether I can replace (end_date) to (disease_code) with values from subsequent observations,
if end_date of nth observation is equal to the start_date of (n+1)th observation.
I wonder whether this is possible under STATA mechanism.
Kindly ask you to spend some of your time to tell me how to do if it is possible.
Thanks in advance!
Jaiwon
Related Posts with How to replace each variable with values of subsquent observation
How to create a varaible based on each value of existing variable in did_imputation?I have the Syntax of did_imputation is as below Array I am wondering how to create the variable Ei.…
How to Getting Rid of The Factorial Variables after Deleting Multicolinear Variables Using "_rmcoll"I have a set of variables X1, X2, X3, X4, X5. Among them, X5 is colinear with X3. So I use the comma…
How to convert the reg command to reghdfe code in controlling three dimensions?How to convert this code controlling for three ways fixed effect to reghdfe code? Code: reg y x i.…
How to create a new binary variable (0-1) based on some conditions in Stata?input id t1 t2 t3 1 1.5 1.4 1.6 2 1.5 . 1.9 3 . 2.0 1.6 4 . . 2.2 5 1.9 2.1 2 6 1.8 2.0 1.9 7 . . . …
Estimation of ATT for a naive regression estimatorHello, I want to estimate an average treatment effect on the treated (ATT) for a naive regression wi…
Subscribe to:
Post Comments (Atom)
0 Response to How to replace each variable with values of subsquent observation
Post a Comment