Hi there,
I need you guys help on creating two binary variables (dropout) and (transtition)
This is my dataset:
Year UE St_ID Area Grade DROPOUT TRANSITION
2009 5355 116 301 1 0 1
2010 5355 116 301 2 0 1
2011 5355 116 301 3 0 1
2009 5355 116 401 1 0 1
2010 5355 116 401 2 0 1
2011 5355 116 401 3 0 1
2008 6181 140 301 1 0
2009 6181 140 301 2 0
2010 6181 140 301 3 0
2008 6181 140 401 1 0
2009 6181 140 401 2 0
2010 6181 140 401 3 0
2009 5150 604 301 1 1 0
2009 5150 604 401 1 1 0
2010 5150 612 301 1 1 1
2011 5150 612 301 2 1 0
2010 5150 612 401 1 1 1
2011 5150 612 401 2 1 0
2010 102652 680 301 3 0 1
2010 102652 680 401 3 0 1
2011 102652 744 301 1 1 0
2011 102652 744 401 1 1 0
a) Creating DROPOUT variable
If St_ID has grade 3, that means he finished school, so dropout = 0 else 1. On my dataset St_ID 604 and 744 don`t have grade 3, so dropout = 1, for all observations (lines)
Because i have multiple observations, this how i tried doing, but it`s not working:
// CREATE HIGH SCHOOL DROPOUT DUMMY
// FIRST VERIFY GRADE IS CONSISTENT FOR ANY
// STUDENT WITHIN THE COURSE OF A YEAR
by St_ID Ano (Serie), sort: assert Serie[1] == Serie[_N]
// caso haja contradicao - comando para identificar contradicao na base
// by St_ID Ano (Serie), sort: gen byte flag = (Serie[1] != Serie[_N])
// browse if flag
// NOW REDUCE TO ONE OBSERVATION PER STUDENT-YEAR
tempfile holding
save `holding'
collapse (first) Serie, by(St_ID Ano)
// IDENTIFY WHEN DROPOUT OCCUR
by St_ID (Ano), sort: gen byte dropout if Serie != 3
HERE MY CONDITION DOSEN`T WORK....
b) TRANSITION VARIABLE (grade to grade)
This is a litle more complicated because i have to look to the future [_n+1} to answer today {_n}. I need to create a variable that ansers the question: Did St_ID go to next grade? if on my dataset there is the following grade, transition =1 ELSE 0. The highest grade level is 3 and for grade 3 we will always have transition = 1.
For this case I wasn`t able to came up with any IF COMBINATIONS syntax.
If someone could help me cdreating those 2 binary variables, I appreciate it.
Max
I need you guys help on creating two binary variables (dropout) and (transtition)
This is my dataset:
Year UE St_ID Area Grade DROPOUT TRANSITION
2009 5355 116 301 1 0 1
2010 5355 116 301 2 0 1
2011 5355 116 301 3 0 1
2009 5355 116 401 1 0 1
2010 5355 116 401 2 0 1
2011 5355 116 401 3 0 1
2008 6181 140 301 1 0
2009 6181 140 301 2 0
2010 6181 140 301 3 0
2008 6181 140 401 1 0
2009 6181 140 401 2 0
2010 6181 140 401 3 0
2009 5150 604 301 1 1 0
2009 5150 604 401 1 1 0
2010 5150 612 301 1 1 1
2011 5150 612 301 2 1 0
2010 5150 612 401 1 1 1
2011 5150 612 401 2 1 0
2010 102652 680 301 3 0 1
2010 102652 680 401 3 0 1
2011 102652 744 301 1 1 0
2011 102652 744 401 1 1 0
a) Creating DROPOUT variable
If St_ID has grade 3, that means he finished school, so dropout = 0 else 1. On my dataset St_ID 604 and 744 don`t have grade 3, so dropout = 1, for all observations (lines)
Because i have multiple observations, this how i tried doing, but it`s not working:
// CREATE HIGH SCHOOL DROPOUT DUMMY
// FIRST VERIFY GRADE IS CONSISTENT FOR ANY
// STUDENT WITHIN THE COURSE OF A YEAR
by St_ID Ano (Serie), sort: assert Serie[1] == Serie[_N]
// caso haja contradicao - comando para identificar contradicao na base
// by St_ID Ano (Serie), sort: gen byte flag = (Serie[1] != Serie[_N])
// browse if flag
// NOW REDUCE TO ONE OBSERVATION PER STUDENT-YEAR
tempfile holding
save `holding'
collapse (first) Serie, by(St_ID Ano)
// IDENTIFY WHEN DROPOUT OCCUR
by St_ID (Ano), sort: gen byte dropout if Serie != 3
HERE MY CONDITION DOSEN`T WORK....
b) TRANSITION VARIABLE (grade to grade)
This is a litle more complicated because i have to look to the future [_n+1} to answer today {_n}. I need to create a variable that ansers the question: Did St_ID go to next grade? if on my dataset there is the following grade, transition =1 ELSE 0. The highest grade level is 3 and for grade 3 we will always have transition = 1.
For this case I wasn`t able to came up with any IF COMBINATIONS syntax.
If someone could help me cdreating those 2 binary variables, I appreciate it.
Max
Comment