help for qogmerge


Merging Quality of Government (QoG)


qogmerge country time , version() format() [options]

country is either (a) a variable holding the names of the countries OR (b) a single country name.

time is either (a) a variable holding the years in the survey OR (b) a single 4-digit year.


qogmerge merges the latest release of Quality of Government (QoG) data to the data stored in the memory.

The QOG-data is a dataset containing aggregate statistics of the Quality of Government of various countries worldwide measured at various points in time. It is provided by University of Gothenburg: The Quality of Government Institute.

qogmerge merges the aggregate information of the QoG data to the dataset in memory, using country and year as a key. To enable this, the user must specify country and year in specific format. The country must be specified either in the "numeric ISO-3166 format" or as "full English country names" as defined by the International Standardization Organization. Year must be specified in 4-digit-numeric-format.

Usually both, country and time, will be specified by listing the variables in the data loaded in memory in which countries and years are stored. If data is based on only one country or on a single year, specify only this country/year instead of a country-variable or a time-variable (see Examples below)

version() defines which version of the QoG-data you want to use. The alternatives are Basic (bas), Standard (std), Social Policy (soc) and the Expert Survey (exp) dataset. Each version has different formats which you have to specify:

format() defines the different datasets. For the Basic and Standard version you can choose between Cross-Section Data (cs) and Time-Series Data (ts). For the Social Policy dataset you can choose cross-Section Data(cs) or Time-Series Data in a long (tsl) or in a wide format (tsw). Merging the Expert Survey is only possible for Country-Level (ctry) data. It is not possible to merge format (ind) since this data is based on a web-survey by country experts and has individual experts, not country-year, as the unit of analysis.

Time information (year) is only available for format(ts/tsl); format(cs/ctry) can only be merged at country-level. If you specify a time-variable (or a single year), this information will be ignored.

other Options

from() is used to specify the location of the QoG-Data. You can specify the complete path on your computer or a local/global macro containing this information. If from() is not specified, qogmerge will use the latest version from the internet (filesize max. 35MB). If you use data stored on your computer, ensure that you use the correct file regarding version() and format(), and vice versa.

All merge-options are allowed with qogmerge. If keep() is not specified, keep(1 3) is default.


Example 1: Merging QoG-data to the World Values Survey (WVS)

Assume you have already downloaded and unzipped the data of the World Values Survey (WVS). We load into memory all rounds of the WVS

. use wvs1981_2008_v20090914.dta, clear

In this file the country names are stored in variable s009. However the information in this file given in ISO 3166 Alpha-2 format, which is not suitable for qogmerge. We use the user defined program kountry by Rafal Raciborski to convert the information stored in s009 into the right format:

. kountry s009, from(iso2c)

This command creates the variable NAMES_STD holding the standardized English country names. You can now use qogmerge. Here we add all variables from QoG to the WVS

. qogmerge NAMES_STD s020, version(std) format(ts)

although it is recommended to apply the option keepusing(varlist) to reduce the size of the new data set.

Example 2: Merge QoG to the 1st wave of European Social Survey (ESS)

. use ESS1e06_2.dta . kountry cntry, from(iso2c) . qogmerge NAMES_STD, version(bas) format(cs)

Example 3: Merge QoG and ESS for Sweden only

. use ESS1e06_2.dta if cntry == "SE" . qogmerge Sweden inwyr, version(soc) format(tsl)

Example 4: Merge OoG to round II of the Eurp. Quality of Life Survey

. use analytical_file_8_sept_2008_compact_file.dta . kountry country_abbr, from(iso2c) . qogmerge NAMES_STD 2007, version(std) format(ts)

Example 5: Using option from() -direct path: . qogmerge country time, version(std) format(ts) from(C:/Data/QoG_t_s_v6Apr11.dta)

-global macro: . global qog "C:/Data/QoG_t_s_v6Apr11.dta" . qogmerge country time, version(std) format(ts) from($qog)


Christoph Thewes, University of Potsdam,

Also see

Help: merge, qoguse (if installed), kountry (if installed)

Online: kountry