I am using the Brazilian microdata from 4 four different census years to create municipal-level variables. I have read the forum threads and blog post that explain the weight variables. I would like to make sure I am using the weights (PERWT and HHWT) correctly when creating these variables. I believe the weight variables show how many people (PERWT) or households (HHWT) that individual or household represents at the municipal level, correct?
For calculating the share of people in each municipality by race, I am adding up the weights (PERWT) for all the people (races white, black, brown, indigenous, asian, and unknown) in that municipality and year. This total is the denominator for calculating my share of people by race. The enumerator for white, for example, is the sum of weights (PERWT) for all people whose race is marked as white. I used the same reasoning on variable AGE2 to calculate the shares of people in each age group.
For calculating the average number of births per woman in each municipality and year, I did sum(CHBORN*PERWT)/sum(PERWT) for each municipality and year.
Four household-level variables such as URBAN, ELECTRIC and WATSUP, I kept only observations where PERNUM=1, and added up the weights (HHWT) for all answers yes and no by municipality and year, to create a total weight. The share of urban households in each municipality and year is the sum of weights for households marked as urban, divided by the total weight variable mentioned above.
I would appreciate your revision and confirmation! Thank you.
On another note, the variable MORTNUM has a lot of missing values. Should those be treated as zeros?