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
Tracking Change OvertimeHi, I would really appreciate any guidance regarding the following: I am working with HRS data, an…
Missing values while using fixed effects model I have household-level panel data from two time periods. I found out that a good portion of my ho…
Panel RegressionHi, I am doing a research paper on panel data taken from BRICS nations as representative of recently…
Creating variable storing means by state and yearGreetings, I'm running Stata 15.1 on OSX. My ultimate objective is to examine the extent that each …
assigning values group-wiseDear community, I have a data set enlisting all previous/current occupations of executives (with st…
Subscribe to:
Post Comments (Atom)
0 Response to How to replace each variable with values of subsquent observation
Post a Comment