Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: R: Merging observations


From   "Carlo Lazzaro" <[email protected]>
To   <[email protected]>
Subject   st: R: Merging observations
Date   Fri, 11 Apr 2008 11:14:44 +0200


Dear Sander,
please find below some temptative answers to your questions (I do hope that
some Stata guru on the list can show you a more efficient way to do the
trick you are searching for).
At first glance, it might seem that you are dealing with an excess of
variables.

HTH and Kind Regards,

Carlo

-----Messaggio originale-----
Sander wrote:
Inviato: venerd� 11 aprile 2008 10.06
A: [email protected]
Oggetto: st: Merging observations

1) The change was not interesting for my research and I just want to
replace the enddate of the first observation with the enddate of the
observation after the change has taken place. Let's say that this has
mutcode==1.
----------------------------------------------------------------
gen end_date_sec_occ= end_date_first_occ if mutcode==1
----------------------------------------------------------------
2) The change was interesting for my research. Let's say that the
marital status of a person has changed to married==1. What I'd like
now, is to create a new variable in the first occurrence, that shows
the startdate of the second occurrence and a second new variable that
shows married2==1. Let's say that the mutcode==2.
----------------------------------------------------------------
gen start_date_sec_occ= end_date_first_occ if mutcode==2

gen married2=1 if mutcode==2

----------------------------------------------------------------
3) When a person moves within a municipality, this is not very
interesting for me. However, when a person moves to another
municipality, this change is interesting. Both have mutcode==3. Is it
possible to do something similar to (2) here for the persons that
moved to another municipality and something similar to (1) when they
move within a municipality.
----------------------------------------------------------------
replace mutcode=4 /*if person move to another municipality
----------------------------------------------------------------



*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index