Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: AW: Generating a dropout dummy variable?


From   Ignacio Martinez <ignacio@virginia.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: AW: Generating a dropout dummy variable?
Date   Sun, 27 Jun 2010 13:32:53 -0400

About the second part:
What I was trying to say is that if i see a student in the year 2000 and
i don't see him in 2001 because he is taking a break but in the year
2005 he is back in my sample I don't want to mark him as drop out but I
want to generate a variable that says that he took a 4 year break.

About your code... I'm kind of lost on how you create the dropout
indicator. Could you explain a little that piece of code?

Thanks a lot

-Ignacio


On Sun, 2010-06-27 at 19:01 +0200, Martin Weiss wrote:
> <> 
> 
> The first part could be:
> 
> 
> *************
> 
> //Create data
> clear*
> set obs 1000
> set seed 43550
> 
> //id
> gen int id=_n
> 
> //expand to # of time periods
> expand 7
> 
> bys id: gen int year=_n+1999
> gen byte graduated=  /* 
> */ cond(runiform()<0.3 & year==2001,1,0) 
> 
> drop if runiform()<.7
> 
> xtset id year
> 
> //get "dropout" indicator
> bys id: egen myvar=total(inlist(year,2000,2001))
> bys id: egen myvar2=total(inrange(year,2002,2006))
> bys id: gen dropout=((myvar==2)*(myvar2==0))& /* 
> */ ((graduated!=1)*(year==2001))
> drop myvar*
> 
> //take a look
> bys id: egen anydropout=max(dropout)
> l if anydropout, sepby(id)
> *************
> 
> 
> I do not understand the second part. Why would dropout be 1 in 2000 if you saw the guy in 2000?
> 
> 
> HTH
> Martin
> 
> -----Ursprüngliche Nachricht-----
> Von: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Ignacio Martinez
> Gesendet: Sonntag, 27. Juni 2010 15:54
> An: statalist@hsphsun2.harvard.edu
> Betreff: st: Generating a dropout dummy variable?
> 
> Hi,
> 
> 
> My panel has the following variables: Year (from 2000 to 2008), ID,
> Graduated (an indicator =1 if the student graduated that year) . 
> 
> I want to generate a dropout variable. If I see ID==1111 in year==2000
> and 2001 but not after that and graduated !=1 in 2001 I want dropout==1
> in 2001 . The only other detail is that if a see someone in 2000 and
> then I see him again in 2006 with graduated=1 I don't want dropout =1 in
> 2000 I want other variable that is break=5 (that student took 5 year of
> break)
> 
> 
> Thanks for the help
> 
> 
> -Ignacio
> 
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
> 
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index