Hi, everybody. I am new to survival analysis. I want to create a multiple-spell & multiple-state data set for further analysis.
The dataset is layout below for illustration-
sid (student ID);csg (current student grade, If the student failed, he/she has to repeat current grade);sgr(if student had grade retention----0(No)/1(Yes));spell (spell)
*This is the expected data set (for illustration purpose, I just listed the 1st two persons).
clear
input byte (sid csg sgr spell time)
1 1 0 1 1
1 2 0 1 2
1 2 1 1 3
1 3 0 2 1
1 4 0 2 2
1 4 1 2 3
1 4 1 3 1
1 4 1 4 1
1 5 0 1 1
1 6 0 1 2
2 1 0 1 1
2 2 0 1 2
2 3 0 1 3
2 4 0 1 4
2 4 1 1 5
2 5 0 2 1
2 5 1 2 2
2 6 0 3 1
end
*This is the real dataset as below,
clear
input byte (sid csg)
1 1
1 2
1 2
1 3
1 4
1 4
1 4
1 4
1 5
1 6
2 1
2 2
2 3
2 4
2 4
2 5
2 5
2 6
3 1
3 2
3 3
3 4
3 5
3 6
4 1
4 1
4 2
4 3
4 4
4 5
4 6
end
I don't know how to use Stata code to crate the variable "sgr","spell", and "time".
By the way, how can I count the number of the students who had more than 1-time grade retentions?
Thank you for your helps!
The dataset is layout below for illustration-
sid (student ID);csg (current student grade, If the student failed, he/she has to repeat current grade);sgr(if student had grade retention----0(No)/1(Yes));spell (spell)
*This is the expected data set (for illustration purpose, I just listed the 1st two persons).
clear
input byte (sid csg sgr spell time)
1 1 0 1 1
1 2 0 1 2
1 2 1 1 3
1 3 0 2 1
1 4 0 2 2
1 4 1 2 3
1 4 1 3 1
1 4 1 4 1
1 5 0 1 1
1 6 0 1 2
2 1 0 1 1
2 2 0 1 2
2 3 0 1 3
2 4 0 1 4
2 4 1 1 5
2 5 0 2 1
2 5 1 2 2
2 6 0 3 1
end
*This is the real dataset as below,
clear
input byte (sid csg)
1 1
1 2
1 2
1 3
1 4
1 4
1 4
1 4
1 5
1 6
2 1
2 2
2 3
2 4
2 4
2 5
2 5
2 6
3 1
3 2
3 3
3 4
3 5
3 6
4 1
4 1
4 2
4 3
4 4
4 5
4 6
end
I don't know how to use Stata code to crate the variable "sgr","spell", and "time".
By the way, how can I count the number of the students who had more than 1-time grade retentions?
Thank you for your helps!
Comment