The variable a13 is the answer for question" Are you currently in school?" 0 is for no,1 is for yes,9 is for unknown,.is missing, and rank from 1989~2011
I want to calculate the school enrollment each year, which means I need the know the number of yes and the number of all the people answered this question, so I use count
The I want to get the percentage,so I use gen:
But, it doesn't work...
I'm so confused why this expression isn't right, and what an easier way to calculate this percentage?
I want to calculate the school enrollment each year, which means I need the know the number of yes and the number of all the people answered this question, so I use count
Code:
count if (age>6)&(a13==1)&(wave==2011) 1,535 count if (a13==1)|(a13==0)|(a13==9)|(a13==.)&(wave==2011) 50,069
Code:
gen per={count if (age>6)&(a13==1)&(wave==2011)}/{count if (a13==1)&(a13==0)&(a13==9)&(a13==.)&(wave==2011)}
I'm so confused why this expression isn't right, and what an easier way to calculate this percentage?
Comment