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 on April 23, and its replacement, is already up and running.

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

st: AW: Generating a dropout dummy variable?

From   "Martin Weiss" <>
To   <>
Subject   st: AW: Generating a dropout dummy variable?
Date   Sun, 27 Jun 2010 19:01:11 +0200


The first part could be:


//Create data
set obs 1000
set seed 43550

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?


-----Ursprüngliche Nachricht-----
Von: [] Im Auftrag von Ignacio Martinez
Gesendet: Sonntag, 27. Juni 2010 15:54
Betreff: st: Generating a dropout dummy variable?


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

Thanks for the help


*   For searches and help try:

*   For searches and help try:

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