About this Resource

Suppose you have a survey where turnout is recorded in several different countries, such as the European Social Survey, and you want to make sure that in your analysis reported turnout matches the official turnout in each country separately. Let's say that the variable with official turnout is called offturnout and is measured as a proportion rather than as a percentage. You can use the following steps to create a suitable weight.

Example 5: Creating a suitable weight

  1. Create a variable which provides the reported level of turnout for each country (muturnout), perhaps with the following command in Stata.

    bysort country: generate muturnout = mean(turnout)

  2. Create the weight using the following Stata commands or similar.

    gen weight = .
    replace weight = offturnout/muturnout if turnout==1
    replace weight = (1-offturnout)/(1-muturnout) if turnout==0

The University of Manchester; Mimas; ESRC; RDI

Countries and Citizens: Unit 4 Combining macro and micro data by Steve Fisher, University of Oxford is licensed under a Creative Commons Attribution-Non-Commercial-Share Alike 2.0 UK: England & Wales Licence.