Description of my data set:
Var 1 is education, with values indicate levels of education.
Var 2 is gender, with values indicate gender.
What I want to do:
to compare the education level difference among male and female. So I want to count the numbers of people with different levels of education divided by male and female (it would be better to show the percentage of education level in each group).
I have the following codes for your reference. Would really appreciate your help!
Thanks.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str4 name str15 education str6 gender "A" "primary school" "female" "B" "primary school" "male" "C" "master degree" "male" "D" "bachelor degree" "female" "E" "bachelor degree" "female" "F" "master degree" "male" end
0 Response to How to count observation number (and percentage) based on var1 by var2?
Post a Comment