Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

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

From |
"Martin Weiss" <martin.weiss1@gmx.de> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
AW: st: AW: Generating a dropout dummy variable? |

Date |
Sun, 27 Jun 2010 19:38:49 +0200 |

<> " About your code... I'm kind of lost on how you create the dropout indicator. Could you explain a little that piece of code?" ************* //get "dropout" indicator //Do I see "id" in 2000 and 2001? bys id: egen myvar=total(inlist(year,2000,2001)) //How many times did I see "id" between 2002 and 2006? bys id: egen myvar2=total(inrange(year,2002,2006)) //dropout is 1 if I saw "id" in 2000 and 2001 //and did not see him again afterwards //and, in 2001, his "graduated" was not 1 bys id: gen dropout=((myvar==2)*(myvar2==0))& /* */ ((graduated!=1)*(year==2001)) ************* See this thread for the tricks re "conditions": http://www.stata.com/statalist/archive/2010-06/msg00985.html 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 19:33 An: statalist@hsphsun2.harvard.edu Betreff: Re: st: AW: Generating a dropout dummy variable? 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/ * * 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/

**Follow-Ups**:**Re: AW: st: AW: Generating a dropout dummy variable?***From:*Ignacio Martinez <ignacio@virginia.edu>

**References**:**st: Generating a dropout dummy variable?***From:*Ignacio Martinez <ignacio@virginia.edu>

**st: AW: Generating a dropout dummy variable?***From:*"Martin Weiss" <martin.weiss1@gmx.de>

**Re: st: AW: Generating a dropout dummy variable?***From:*Ignacio Martinez <ignacio@virginia.edu>

- Prev by Date:
**AW: st: AW: problem when importing graphs into word** - Next by Date:
**Re: st: AW: Generating a dropout dummy variable?** - Previous by thread:
**Re: st: AW: Generating a dropout dummy variable?** - Next by thread:
**Re: AW: st: AW: Generating a dropout dummy variable?** - Index(es):