The following steps are similar to those in the previous subsection but produce a weight variable that you can use for analysis where you want to make inferences about the population as a whole, so micro units within a given macro unit are weighted according to the true population for that macro unit. For this you will need a variable that gives the population figure for each macro unit (mupop ).
- Generate a variable that, for every micro unit within a given macro unit, takes the value of
                            the
                            sum of surveyweight within that macro unit. In Stata this can be done using the following
                            command.
                            bysort macrounit: gen muess = sum(surveyweight) You can use whatever variable name you like, but muess stands for macro unit effective sample size. 
- Generate the analysis weight using the following formula.
                            analysisweight = (avepermu/mupop)*surveyweight In Stata you can create this variable by simply using the generate command and then typing the above formula. 
 
 



