Dear Stata users,
I am new to stata and am working on a dataset with 20 mio. people for two years with zipcodes for each person to identify the municipality they live in.
I have the following question:
I want to create a variable that gives me the literacy rate for each municipality (zipcode).
I have a dummy variable that tells me if an individual is literate and I have the total number of people that live in each municipality; I also have a weight for sample expansion (since not the whole population is represented in my dataset).
I tried creating said variable with the following code, but if I summarize my literacy rate variable it does not give me a reasonable number (between 0 and 1).
egen literation = sum(literacy) if literacy == 1, by(zipcode)
gen literacy_rate = literation/popcount
My question is: how do I include the sample weights into the literacy_rate variable?
Thanks in advance for tips where I can read up on this.
Related Posts with Create a rate variable for population as a whole with sample weights
Business calender: Get omitted dates using bodf()I have a list of dates for specific company events of listed US companies. This variable (reguldate)…
putdocx cell / row heightIs there a way to control the row or cell height in a putdocx table? …
How to set the X axis in the DASP package in stataI want to use the DASP plug-in in stata and use the Lorenz curve to analyze the fairness of inter-pr…
Optimal lags and Error-correction modelGood morning everyone; I want to perform a cointegration with the Error correction model. Everythi…
How to evaluate the following hypothesizes?Hello all! I am currently working on a research project and I have a dataset of bankrupt and non-ba…
Subscribe to:
Post Comments (Atom)
0 Response to Create a rate variable for population as a whole with sample weights
Post a Comment