Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: date dilemma


From   "Robert Bozick" <[email protected]>
To   <[email protected]>
Subject   st: date dilemma
Date   Wed, 23 Jul 2003 16:05:29 -0400

Hello Everyone --

I am relatively new to using the date variable commands in STATA.  Here is my problem:  I am trying to create a variable that is equal to 1 if a member of my sample enrolled in school before September 1, 1989.  I first created a variable (called edate1) for all sample members where the date was September 1, 1989 for everyone:

gen m1 = 09
gen d1 = 01
gen y1 = 1989
gen edate1 = mdy(m1, d1, y1)

The date of first enrollment is already in date format and is called projentrydt.  In order to find out if the first enrollment date is before September 1, 1989 -I created the indicator variable called entry1:

gen entry1 = 1 if projentrydt < edate1

This procedure produces 11 observations coded 1.  When I have STATA list out the first enrollment dates of these 11 observations, not all first enrollment dates are before September 1, 1989:

 list projentrydt if entry1 == 1

       +-----------+
       | projent~t |
       |-----------|
 1502. | 18 Jul 95 |
 1690. | 15 May 77 |
 1766. | 15 May 77 |
 2495. | 31 Jul 94 |
 5366. | 18 May 96 |
       |-----------|
 7715. | 15 Oct 79 |
 9695. | 10 Jan 09 |
 9995. | 12 Oct 96 |
14472. | 15 Jan 89 |
14916. | 13 Nov 00 |
       |-----------|
16655. | 30 Jun 89 |
       +-----------+


I have been staring at this for a few hours -- am I missing something obvious?  I keep thinking it has soemthing to do with the gen entry1 command...I am not sure.  Again, I am relatively new to using dates in STATA.  How can I get STATA to create a variable that indicates only those who enrolled before September 1, 1989?


Thanks in advance,
Robert
  




*
*   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