Of course. Yes, you can absolutely identify respondents from Scotland within the Great Britain (GB) cohort in the European Social Survey (ESS) data.
This is done using a specific regional variable. Here’s a detailed breakdown of how to do it.
The Key Variable: REGION
The ESS includes a variable, typically named REGION, which contains codes for the sub-national territories of each participating country. For Great Britain, these codes are based on the NUTS 1 statistical regions (Nomenclature of Territorial Units for Statistics).
The NUTS 1 code for Scotland is UKM.
Step-by-Step Guide to Identifying Scotland
Download the Data: Get the ESS data for the round(s) you are interested in from the official ESS Data Portal.
Filter for Great Britain: First, you need to isolate all respondents from Great Britain. The country variable is CNTRY, and the code for Great Britain is 'GB'.
Filter for Scotland: Next, within the Great Britain subset, you will use the REGION variable to select only the respondents from Scotland.
The logic is:
Select all cases where CNTRY is equal to 'GB'.
From that group, select all cases where REGION is equal to 'UKM'.
Code Examples
Here is how you would perform this task in common statistical software packages. Note that variable names in downloaded files are often in lowercase (e.g., cntry, region).
R (using dplyr)
r
# Load necessary library
library(dplyr)
# Assuming your ESS data is in a dataframe called 'ess_data'
# Filter for respondents from Scotland
scotland_data <- ess_data %>%
filter(cntry == "GB" & region == "UKM")
# To verify, you can view the unique regions within GB
ess_data %>%
filter(cntry == "GB") %>%
distinct(region)
Stata
stata
* Load your ESS data file first
* use "your_ess_data_file.dta", clear
* Create a new variable to identify Scotland respondents
* This is a safe way to not lose data
generate is_scotland = 0
replace is_scotland = 1 if cntry == "GB" & region == "UKM"
* Or, if you want to keep ONLY the Scotland data
keep if cntry == "GB" & region == "UKM"
* To see the region codes within Great Britain
tabulate region if cntry == "GB"
Python (using pandas)
python
# Load necessary library
import pandas as pd
# Assuming your ESS data is in a DataFrame called 'df'
# df = pd.read_csv('your_ess_data.csv') or pd.read_stata('your_ess_data.dta')
# Filter for respondents from Scotland
scotland_df = df[(df['cntry'] == 'GB') & (df['region'] == 'UKM')]
# To see the region codes within Great Britain
print(df[df['cntry'] == 'GB']['region'].unique())
Important Considerations
GB vs. UK: The ESS country code is 'GB' (Great Britain), which includes England, Scotland, and Wales. It does not include Northern Ireland. This is a very common point of confusion. Northern Ireland is part of the United Kingdom but is not surveyed as part of the 'GB' sample in the ESS.
Check Documentation: While the UKM code for Scotland has been stable, it is always best practice to check the variable documentation for the specific ESS round you are using. NUTS classifications can be updated over time. You can find this documentation on the ESS website alongside the data download.
Variable Naming: As mentioned, variable names in the actual data files are usually lowercase (cntry, region). Always check your file's variable list to be sure.
By following these steps, you will be able to reliably and accurately isolate the Scottish sample for your analysis.