The following steps produce a weight variable that you can use for analysis where you want each macro unit to contribute equally.

Example 3: produce a weight variable

- 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 a variable that gives the average number of micro units per macro unit. You can do this by hand. Find out the number of micro units and the number of macro units in the data (without weighting) and divide the former by the latter. Note that this variable will be a constant for all units in your data set, so having calculated the number, x, you can generate the variable, in Stata, with the command.
generate avepermu = x

- Generate the analysis weight using the following formula.
generate analysisweight = (avepermu/muess)*surveyweight