I have panel data. Each ID in different years(7 waves) has different English, math or science grades; in some waves, they haven't reported it and it's missing. Now I want to keep variable English_grade for each ID only in waves 6 or 7 and get rid of English grades in other waves(They can be reported as missing).
I know the command is not correct but maybe I need sth like that( keep English_grade if Wave==6|7 else drop English_grade). Would you please recommend me a code to solve it?
Thanks,
Mahdi
I know the command is not correct but maybe I need sth like that( keep English_grade if Wave==6|7 else drop English_grade). Would you please recommend me a code to solve it?
ID | Wave | English_grade | Math_grade | Sceinec_grade |
1 | 1 | 75 | ||
1 | 2 | . | ||
1 | 3 | . | ||
1 | 4 | 84 | ||
1 | 5 | . | ||
1 | 6 | . | ||
1 | 7 | 88 | ||
2 | 1 | . | ||
2 | 2 | . | ||
2 | 3 | 55 | ||
2 | 4 | 70 | ||
2 | 5 | . | ||
2 | 6 | 69 | ||
2 | 7 | . |
Mahdi
Comment