Hello everyone,
my data set contains 8,232 students (IDaluno) in 60 schools (IDescola) in a panel structure with T=5 (wave).
I would like to create a dummy (repeat) for students that have repeated the school years. Students have repeated the school year if they did NOT take the performance tests in the expected grade.
The expected chronological sequence (with no retention) is:
- Wave 1 and 2 by the grade 1;
- Wave 3 by the grade 2;
- Wave 4 by the grade 3;
- Wave 5 by the grade 4.
So, I have the following commands.
Note that the commands do not work correctly, because in case of a retention, the repeat is 1 for all subsequent years even when the student passed on to the next grade.
Example: IDaluno=13649. For waves 1, 2 and 3 the dummy repeat is correct, but not for waves 4 and 5. The student repeated the grade 1 but not the grades 2 and 3.
Does anyone have any idea of how can I create that?
Any advice would be highly appreciated!
Thanks in advance.
my data set contains 8,232 students (IDaluno) in 60 schools (IDescola) in a panel structure with T=5 (wave).
I would like to create a dummy (repeat) for students that have repeated the school years. Students have repeated the school year if they did NOT take the performance tests in the expected grade.
The expected chronological sequence (with no retention) is:
- Wave 1 and 2 by the grade 1;
- Wave 3 by the grade 2;
- Wave 4 by the grade 3;
- Wave 5 by the grade 4.
So, I have the following commands.
Code:
generate repeat=0 replace repeat=1 if wave==3 & grade==1 replace repeat=1 if wave==4 & grade<=2 replace repeat=1 if wave==5 & grade<=3
Example: IDaluno=13649. For waves 1, 2 and 3 the dummy repeat is correct, but not for waves 4 and 5. The student repeated the grade 1 but not the grades 2 and 3.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long(IDaluno IDescola) byte wave float(grade repeat) 13648 35059122 1 1 0 13648 35059122 2 1 0 13648 35059122 3 2 0 13648 35059122 4 2 1 13648 35059122 5 3 1 13649 35059122 1 1 0 13649 35059122 2 1 0 13649 35059122 3 1 1 13649 35059122 4 2 1 13649 35059122 5 3 1 13650 35059122 2 1 0 13650 35059122 4 3 0 13650 35059122 5 4 0 13651 35059122 1 1 0 13651 35059122 2 1 0 13651 35059122 3 2 0 13651 35059122 4 3 0 13651 35059122 5 4 0 13652 35059122 1 1 0 13652 35059122 2 1 0 13652 35059122 3 2 0 13652 35059122 4 3 0 13652 35059122 5 4 0 13653 35059122 1 1 0 13653 35059122 2 1 0 13653 35059122 3 2 0 13653 35059122 4 3 0 13653 35059122 5 4 0 13654 35059122 1 1 0 13654 35059122 2 1 0 13654 35059122 3 2 0 13654 35059122 4 3 0 13654 35059122 5 4 0 13655 35059122 1 1 0 13655 35059122 2 1 0 13655 35059122 3 2 0 13655 35059122 4 3 0 13655 35059122 5 4 0 13656 35059122 1 1 0 13656 35059122 2 1 0 end format %ty wave label values IDescola Escola
Does anyone have any idea of how can I create that?
Any advice would be highly appreciated!
Thanks in advance.

Comment