Hello,
I have a small dataset as follows, id is student id, and gr represents grade. If a student failed grade, then the student will repeat grades and the new variable "GR" should be equal to 1, otherwise 0.
If the gr value is missing value, then "GR" is also equal to missing value.
clear
input byte (id gr)
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 .
3 3
3 4
3 .
3 6
4 1
4 1
4 2
4 3
4 4
4 5
4 6
end
I ever asked this question at https://www.statalist.org/forums/forum/general-stata-discussion/general/1654328-ask-for-help-to-create-multiple-sell-and-multiple-state-data-using-statat
However, I forgot the issue of missing value. So, today I asked here.
Can someone help me with the Stata code?
Thank you!
Related Posts with How to Correctly Create a Variable to Indicate if a student Failed Grade in Stata?
Heckman selection model in three stagesDear Statalist, I hope you are well. Please, I would like to ask regarding the Heckman selection mod…
Error Using the Command 'using'Hello everyone, I just downloaded data from PSID. Every time I run the do.file that comes with the …
Tokenize and looping through tokensHi Statlist, I have the following problem. I have defined 3 local variables defining the path to so…
Issues with Lincom commandHello, I posted this question a few days ago, and I am trying to use the lincom command to find the …
Should I rename all the variables with the year immediately following the original variable names when I merge data across years with loopI run the following code: local i = 1998 while `i' < 2007{ local j=`i'+1 **step 10: match by …
Subscribe to:
Post Comments (Atom)
0 Response to How to Correctly Create a Variable to Indicate if a student Failed Grade in Stata?
Post a Comment