Specialized on Data processing, Data management Implementation plan, Data Collection tools - electronic and paper base, Data cleaning specifications, Data extraction, Data transformation, Data load, Analytical Datasets, and Data analysis. BJ Data Tech Solutions teaches on design and developing Electronic Data Collection Tools using CSPro, and STATA commands for data manipulation. Setting up Data Management systems using modern data technologies such as Relational Databases, C#, PHP and Android.
Saturday, May 7, 2022
Compute Female proportion in each district in long format data in Stata.
I have a long format dataset where it has 5 variables:
did---district id
sid---school id
id--student id
age --student age
count-Bonus count
male--student gender(1-male;0-female)
Now, I want to compute female proportions for each district.
Thank you for your Stata code.
* Example generated by -dataex-. For more info, type help dataex.
clear
input int did long sid float(id age count male)
1 11 111 42 20 1
1 11 111 30 20 1
1 11 111 42 10 1
1 11 111 34 10 1
1 11 111 30 10 1
1 11 111 33 10 1
1 12 112 39 20 0
1 12 112 40 20 0
1 12 112 43 20 0
1 12 112 33 20 0
1 13 113 40 10 1
1 13 113 41 20 1
1 13 113 38 20 1
1 14 114 32 10 0
1 14 114 35 10 0
1 14 114 32 20 0
1 14 114 37 10 0
1 15 115 31 10 0
1 15 115 29 10 0
1 15 115 36 10 0
1 15 115 37 20 0
1 16 116 31 20 1
1 16 116 36 20 1
1 16 116 38 10 1
1 16 116 27 10 1
1 16 116 35 20 1
1 17 117 39 10 0
1 17 117 44 20 0
1 17 117 41 10 0
1 17 117 34 20 0
1 17 117 45 20 0
1 17 117 28 10 0
2 21 211 48 10 0
2 21 211 38 10 0
2 21 211 31 20 0
2 21 211 34 10 0
2 22 222 42 10 1
2 22 222 37 20 1
2 22 222 40 20 1
2 22 222 44 10 1
2 22 222 42 20 1
2 23 222 37 10 1
2 23 223 43 20 1
2 23 223 47 10 1
2 23 223 35 20 1
2 24 224 44 20 0
2 24 224 40 10 0
2 24 224 45 10 0
2 24 224 36 20 0
2 24 224 39 10 0
2 25 225 41 20 1
2 25 225 34 20 1
2 25 225 39 20 1
2 25 225 36 10 1
2 25 225 38 20 1
2 26 226 33 10 0
2 26 226 46 10 0
2 26 226 45 20 0
2 26 226 35 10 0
2 26 226 41 10 0
2 27 227 33 20 1
2 27 227 43 10 1
2 27 227 46 20 1
2 27 227 32 20 1
3 31 331 35 20 0
3 31 331 42 10 0
3 32 332 73 10 1
3 32 332 29 20 1
end
No comments:
Post a Comment