I have a data set that includes variables on individual's district (where a person lives) and occupation. I am trying to generate a new variable that tells me the occupation shares by district; i.e. if there are 10 people in the 1st district and 3 are farmers, I want the new variable created to say 0.3 for everyone that is a farmer in that district. Thus far I have tried:
bysort district: tab occupation
however, as there are over 600 districts in the sample, it would be very labor intensive to enter all the frequencies by hand. I have also tried
egen freq=pc(occupation), by(district) prop
but this does not return that correct proportions.
I would really appreciate help with this. Thanks!
Related Posts with Create variable of group frequencies
Panel specification- choosing the best modelHi, I try to model panel data with N=28 and T=15 (tsset number year). I have one binary variable in …
How do I interpret a log level and log log model when my independent variable is already a percentage?Hi everyone I have a regression in which I would like to estimate the effect of migrant share (fro…
Issue with xtologit (non concave routine)Hallo everybody I ask for your help to manage an issue as described in the object of this post. I am…
Plotting marginal effects, confidence intervals after bootstrapDear listers, I have searched the manual and dug through the list but have come up empty. So apolog…
Estimate dynamic discrete choice (2 periods)Hello, I need to estimate a 2 period choices model. I understand the basic idea of estimating choic…
Subscribe to:
Post Comments (Atom)
0 Response to Create variable of group frequencies
Post a Comment