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
95% confidence intervals from pwcorrHello I am running the following command in Stata: Code: pwcorr drug*, star(0.001) sig Since I ha…
"Rename" isn't letting me change variable names to lowercase.I’ve concatenated four years of survey data (2013-2016). Most of the variables in each year are the …
Help with bootstrapping 95% confidence interval for variance components (random effects)Greetings! I have a longitudinal dataset consisting of 10,051 observations nested within 413 subject…
Difference-in-difference fixed effects with multiple periodsDear all, I am trying to run a difference-in-difference fixed-effects model. The challenge here is …
Data Analyst, Research Job Opening - Center for Community Health, Northwestern UnviersityWorking in the Center for Community Health in Northwestern University’s Institute of Public Health, …
Subscribe to:
Post Comments (Atom)
0 Response to Create a rate variable for population as a whole with sample weights
Post a Comment