Statalist The Stata Listserver


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

Re: st: creating retrospective event data


From   "Austin Nichols" <[email protected]>
To   [email protected]
Subject   Re: st: creating retrospective event data
Date   Wed, 13 Jun 2007 17:39:02 -0400

Kelly--

Once you have year and month coded for each observation in your data,
and your m1sd and m1ed up through m12sd and m12ed variables set up as
elapsed %tm monthly dates (see -help date functions-), then you could

g date=ym(year, month)
g byte married=0
forv i=1/12 {
replace mar=1 if inrange(date,m`i'sd,m`i'ed) & !mi(m`i'sd,m`i'ed)
}

or somesuch. You may also at some point want a variation on
http://www.stata.com/statalist/archive/2007-04/msg00798.html

On 6/13/07, Richardson, Kelly K. <[email protected]> wrote:
Dear Statalisters,

I have data for one wave that asks people about the month and year
various events took place in their past. For example, what month/year
were you married (assuming ever married) and what month/year did
marriage end (assuming marriage ended).  I want to create a data set
that has monthly data for each respondent from 1994-2002. So, let's say
an individual gets married in March of 1998 and divorced in September of
2001. I want to code this individual "0" for all months from January of
1994 through February of 1998; code "1" from March '98 through September
'01, and "0" for October '01 through December of '02.
*
*   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