The NextGen Harmonised Data Gateway
  • Home
  • Variable Database
    • Variable Database
    • Make it Green!
    • Make it Digital!
    • Make it Equal!
    • Make it Healthy!
    • Make it Strong!
  • Harmonisation
    • Harmonisation Toolbox
    • Make it Green!
    • Make it Digital!
    • Make it Equal!
    • Make it Healthy!
    • Make it Strong!
  • Data
  • Training
  • Contact
    • User Support
    • Team

On this page

  • Set-up
  • 1. Prepare Data: EB 2003
  • 2. Prepare Data: ISSP 2022
  • 3. Harmonisation
  • Summary

Care for Children: Mother or Father

This page guides you through the harmonisation process of the Care for Children: Mother or Father item.

The harmonised Make it Equal! data currently includes EB 2003 and ISSP 2022. Please note that GGS 2020 data is currently not available. Before we start harmonising, please download these data sets from the respective repositories. You can find links to the survey repositories on the Make It Equal! data documentation page, in the section devoted to Care for Children: Mother or Father. If you click on the single year, the link takes you to the specific data set. We are working with the .sav format. So please make sure to download the datasets in this format.

Set-up

Please download the statistical software R (R Core Team, 2024) and RStudio (RStudio Team, 2023). Then start a project in RStudio by clicking File > New Project and set up a new directory or assign your project to an existing directory (i.e., folder). Within the project directory, create a folder called “data”. Now save the downloaded ESS and EB survey data into this “data” folder. Lastly, please download the following packages using the install.packages() function if they have not been installed before.

install.packages()
packages <- c( "tidyverse", "readxl", "xlsx", "haven", "labelled", "tidyr", "knitr", "kableExtra", "dplyr", "openxlsx")

installed <- packages %in% rownames(installed.packages())
if (any(!installed)) install.packages(packages[!installed])

Every package installed in R must also be loaded. This is what the library-function is for.

library(tidyverse)
library(readxl)
library(openxlsx) # If you have problems installing or loading the xlsx-package, use the openxlsx. 
library(haven)
library(labelled)
library(tidyr)
library(knitr)
library(kableExtra)
library(dplyr)

An important step during the harmonisation process is to prepare the source data sets in a consistent and systematic way. For that, the functions “codebook” (create_codebook_short()) and ”crosswalk table” (create_cwt()) by Kołczyńska (2022) are used. They show the correspondence between source data sets and harmonised data regarding variable names and values. These functions are adopted into our needs and the R file containing them can be downloaded here . Please save this file in the R project folder and import it into the R project via source("kolczynska2022_i4ng.R").

How-to

If you cannot download the R-file and if it is opened in a new tab, please open a new file in your R-Studio project under File -> New File -> R Script and copy the text from the kolczynska2022-file into this new file. Make sure that you save this new file in your project folder under the name “kolczynska2022_i4ng.R”.

source("kolczynska2022_i4ng.R")

Now we can name our target variable as “e_cp_care”. The name is a combination of “e” representing the main topic “Equal”, the concept “Childcare and Parenting” and the variable label “Care for Children: Mother or Father”.

target_var_hrms <- "e_cp_care"

Before we can harmonise any data, we need to prepare the source data sets:

1. Prepare Data: EB 2003

Six steps must be carried out in the following coding section:

1.1 Import data

Please note that a new country variable is created and called “ISOCNTRY_fixed” since data has “” for ICELAND in the ISOCNTRY variable. The value lable must be recoded into “IS”.

eb <- haven::read_sav("data/ZA3903_v1-0-1.sav", user_na=TRUE)  %>% 
  mutate(ISOCNTRY_fixed = ifelse(ISOCNTRY == "", "IS", ISOCNTRY), 
         ISOCNTRY_fixed = labelled_spss(ISOCNTRY_fixed, label = "Fixed NATION - ALL SAMPLES"))
Check the source item

Use this output to compare it with your output. Check especially if the labels match.

eb %>% count(v447)
# A tibble: 4 × 2
  v447                                        n
  <dbl+lbl>                               <int>
1 1 [Yes]                                 13836
2 2 [No]                                   1773
3 3 (NA) [DK]                               761
4 9 (NA) [Inap., <coded 15 and 19 in V8>]  1635

1.2. Create codebook

Not just the substantive variables but also protocol variables need to be selected from this data set. Protocol variables selected for this harmonisation are the source data’s country, weight, and ID variables. In this step, we create a codebook that provides an overview of the selected variables and their naming in the harmonised data.

codebook_eb <- create_codebook_short(eb) %>%
  mutate(survey = "EB",
         target_var = ifelse(var_source == "ISOCNTRY_fixed", "country_source", NA),
         target_var = ifelse(var_source == "v11", "w1_poststr", target_var),
         target_var = ifelse(grepl("ORIGINAL RESPONDENT ID", var_label_source, perl = TRUE), "caseID_source", target_var),
         target_var = ifelse(grepl("FAMILY ROLES: DIVIDE CHILD CARE", var_label_source), 
                             target_var_hrms, # Find NAME FOR THE TARGET VARIABLE to be harmonised
                             target_var),
         target_var = gsub(" ", "_", target_var),
         target_var = tolower(target_var))

codebook_eb includes the columns called: var_source, var_label_source, survey, target_var. The variable names which will be used in the harmonised data are listed under target_var.

var_source var_label_source survey target_var
v11 W3 WEIGHT SPECIAL GERMANY EB w1_poststr
v447 Q49 FAMILY ROLES: DIVIDE CHILD CARE EB e_cp_care
v601 ORIGINAL RESPONDENT ID (COUNTRY+INTERV NR) EB caseid_source
ISOCNTRY_fixed Fixed NATION - ALL SAMPLES EB country_source

 

1.3. Retrieve names of the chosen source variables

variables <- codebook_eb %>% drop_na(target_var) %>% pull(var_source)

The retrieved variables are: v11, v447, v601, ISOCNTRY_fixed.

 

1.4. Select a subset of the survey data containing only the chosen variables

eb_small <- eb %>% select(all_of(variables)) %>% mutate(caseid = row_number())

You will see that the following data set is a subset of the EB 2003 including the chosen variables for the harmonised data. The first six rows of the dataset are as follows:

v11 v447 v601 ISOCNTRY_fixed caseid
0.9519 1 200001 BE 1
0.8504 1 200166 BE 2
1.2633 1 200133 BE 3
0.5251 1 200135 BE 4
1.2138 1 215141 BE 5
0.9498 1 215142 BE 6

 

1.5. Create a crosswalk table for the chosen variables

A crosswalk table provides a connection between the source variable values and the target variable values. First, it provides the variables, their labels, and the possible values. Then, the information is linked with the codebook information of the newly specified target variables. Lastly, target values are defined in a variable called target_value.

Here, weight and ID variables are excluded from the crosswalk table. Original codes for the country variable are preserved. Lastly, NAs are assigned to missing values.

eb_cwt <- create_cwt(eb_small %>%
                        select(ISOCNTRY_fixed, v447)) %>% 
  left_join(codebook_eb, by=join_by(var_source, var_label_source)) %>%
  mutate(target_value = NA,
         target_value = ifelse(!grepl("know|efusal|answer|NA|applicable|Can't choose|Na|3] DK", value_label_source), 
                               value_code, 
                               target_value),
         value_code = as.character(value_code)
  )
Important

There are decisions about the substantive variable made by taking into account both EB and ISSP data. The utility of creating a crosswalk table is that the results of these decisions can be seen explicitly by comparing the value_code and target_value columns.

In particular, definitions of missing values differ across EB and ISSP. They are not harmonised but instead recoded into the single missing value “NA” except cases classified as inapplicable (inap.). They are not recoded at this stage but in the harmonisation Step 3.5, where they are assigned the value −999. The code −999 represents a distinct missing category, which is denoted as “Inap. from source data sets”. Please see the ‘Further notes’ section on the documentation page of the Make it Equal! Data.

Let’s look at the correspondence between e_cp_care and v447:

eb_cwt %>% filter(var_source == "v447") %>% 
  #select(ends_with("source"), value_n, value_code, starts_with("target"))%>%
  kable(row.names = FALSE) %>%
  kable_styling(full_width = FALSE, bootstrap_options = c("striped", "hover"))
var_source var_label_source npos value_n value_label_source value_code survey target_var target_value
v447 Q49 FAMILY ROLES: DIVIDE CHILD CARE 1 [1] Yes: 13836 [1] Yes 1 EB e_cp_care 1
v447 Q49 FAMILY ROLES: DIVIDE CHILD CARE 2 [2] No: 1773 [2] No 2 EB e_cp_care 2
v447 Q49 FAMILY ROLES: DIVIDE CHILD CARE 3 [3] DK: 761 [3] DK 3 EB e_cp_care NA
v447 Q49 FAMILY ROLES: DIVIDE CHILD CARE 4 [9] Inap., <coded 15 and 19 in V8>: 1635 [9] Inap., <coded 15 and 19 in V8> 9 EB e_cp_care 9
Optional

It might be useful to export the crosswalk table as a spreadsheet since it serves as a reference document that visualises the connection between the source and harmonised data set.

write.xlsx(eb_cwt, paste("data/",  target_var_hrms, "_cwt_eb.xlsx", sep = ''))

 

1.6. Recode survey data using the crosswalk table

To be able to merge survey data with the crosswalk table information, we first need to convert the wide data format to a long data format.

eb_small_long <- eb_small %>% 
  mutate(across(everything(), as.character)) %>% 
  pivot_longer(cols = c(v447, ISOCNTRY_fixed),
               names_to = "var_source", values_to = "value_source") 

This is how the first six rows of the eb_small_long should look like:

v11 v601 caseid var_source value_source
0.9519 200001 1 v447 1
0.9519 200001 1 ISOCNTRY_fixed BE
0.8504 200166 2 v447 1
0.8504 200166 2 ISOCNTRY_fixed BE
1.2633 200133 3 v447 1
1.2633 200133 3 ISOCNTRY_fixed BE

Now we use left_join() to recode source values according to the crosswalk table, eb_cwt.

eb_hrmsd <- eb_small_long %>%
  left_join(eb_cwt, by = c("value_source" = "value_code", "var_source")) %>%
  select(-c(npos, value_n)) %>%
  mutate(target_value = as.character(target_value)) %>%
  pivot_wider(
    id_cols = c(v11, v601, caseid, survey),    # Columns to keep as unique identifiers
    names_from = target_var,      # Column that will become the new column names
    values_from = target_value         # Column containing the values for those new columns
  ) %>% pivot_longer(
    cols = all_of(target_var_hrms),
    names_to = "target_var", values_to = "target_value") %>%
  rename(caseID_source = v601)

Now, EB data is ready for harmonisation. This is how the first six rows of the eb_hrmsd should look like:

v11 caseID_source caseid survey country_source target_var target_value
0.9519 200001 1 EB BE e_cp_care 1
0.8504 200166 2 EB BE e_cp_care 1
1.2633 200133 3 EB BE e_cp_care 1
0.5251 200135 4 EB BE e_cp_care 1
1.2138 215141 5 EB BE e_cp_care 1
0.9498 215142 6 EB BE e_cp_care 1
Optional

At this step, the prepared data can be exported as an Rdata file and saved for later re-use.

saveRDS(eb_hrmsd, paste("data/",  target_var_hrms, "_eb.rds", sep = ''))

 

2. Prepare Data: ISSP 2022

We will follow the same steps used for the EB 2003 item. As expected, ISSP and EB data have differences, and they are taken into account in implementing these steps.

 

2.1. Import data

issp <- haven::read_sav("data/ZA10000_v2-0-0.sav", user_na=TRUE)
Check the source item

Use this output to compare it with your output. Check especially if the labels match.

issp %>% count(v8)
# A tibble: 7 × 2
  v8                                              n
  <dbl+lbl>                                   <int>
1 -9 (NA) [No answer]                           235
2 -8 (NA) [Can't choose]                        783
3  1 [Mothers are much better suited]          6108
4  2 [Mothers are somewhat better suited]      9857
5  3 [Mothers and fathers are equally suited] 28215
6  4 [Fathers are somewhat better suited]       386
7  5 [Fathers are much better suited]           178

 

2.2. Create codebook

Protocol variables selected for this harmonisation are the source data’s country, weight, and ID variables. Note that there are two weight variables: design and post-stratification weights. Both of them are included.

codebook_issp <- create_codebook_short(issp) %>%
  mutate(survey = "ISSP",
         target_var = ifelse(var_source == "c_alphan", "country_source", NA),
         target_var = ifelse(var_source == "DWEIGHT_COM", "w1_design", target_var),
         target_var = ifelse(var_source == "PSWEIGHT", "w2_poststr", target_var),
         target_var = ifelse(var_source == "WEIGHT_COM", "w3_combined", target_var),
         target_var = ifelse(grepl("RESPONDENT ID|ID Number", var_label_source), "caseID_source", target_var),
         target_var = ifelse(grepl("Q2b Mother or father better suited to look after children", var_label_source), 
                             target_var_hrms, # NAME FOR THE TARGET VARIABLE to be harmonised
                             target_var),
         target_var = gsub(" ", "_", target_var),
         target_var = tolower(target_var))

The variable names which will be used in the harmonised data are listed under target_var. The same names are used except for the weight variables because there is more than one weight variable.

var_source var_label_source survey target_var
c_alphan Country/ Sample Prefix ISO 3166 code - alphanumeric ISSP country_source
v8 Q2b Mother or father better suited to look after children ISSP e_cp_care
CASEID ID Number of respondent ISSP caseid_source
DWEIGHT_COM HH + TS combination of all design aspects ISSP w1_design
PSWEIGHT Post-stratification weight ISSP w2_poststr
WEIGHT_COM Combination of all weights ISSP w3_combined

 

2.3. Retrieve names of the chosen source variables

variables <- codebook_issp %>% drop_na(target_var) %>% pull(var_source)

The retrieved variables are: c_alphan, v8, CASEID, DWEIGHT_COM, PSWEIGHT, WEIGHT_COM.

 

2.4. Select a subset of the survey data containing only the chosen variables

issp_small <- issp %>% select(all_of(variables)) %>% mutate(caseid = row_number())

You will see that the following data set is a subset of the ISSP 2022 with the chosen variables for the harmonised data. The first six rows of the dataset are as follows:

c_alphan v8 CASEID DWEIGHT_COM PSWEIGHT WEIGHT_COM caseid
AT 3 2022000400000001 1.2100928 0.6275077 0.1704467 1
AT 2 2022000400000002 1.2100928 1.5294630 0.8532898 2
AT 3 2022000400000003 1.6492026 2.3939996 3.1399147 3
AT 2 2022000400000004 1.6492026 1.0572973 2.9059087 4
AT 3 2022000400000005 0.6752907 0.4600839 0.5305116 5
AT 3 2022000400000006 0.6752907 0.5624356 0.6384159 6

 

2.5. Create a crosswalk table for the chosen variables

Similar to what was implemented in step 1.5, weight and ID variables are excluded from the crosswalk table. Only country and the substantive variable are used for creating the crosswalk table. Original codes for the country variable are preserved. For the substantive variable, “NA” is assigned to missing values; the other values are kept identical.

issp_cwt <- create_cwt(issp_small %>% select(c_alphan, v8)) %>% 
  left_join(codebook_issp, by=join_by(var_source, var_label_source)) %>%
  mutate(target_value = NA,
         target_value = ifelse(!grepl("know|efusal|answer|NA|applicable|Can't choose|Cant Choose|]DK|] DK|Na|Cant choose|Refused", value_label_source), #* CHECK
                               value_code, 
                               target_value),
         value_code = as.character(value_code)
  )
Important

The survey-specific missing values are recoded into the single missing value “NA”.

Let’s look at the correspondence between e_cp_care and v8:

issp_cwt %>% filter(var_source == "v8") %>%
  kable(row.names = FALSE) %>%
  kable_styling(full_width = FALSE, bootstrap_options = c("striped", "hover"))
var_source var_label_source npos value_n value_label_source value_code survey target_var target_value
v8 Q2b Mother or father better suited to look after children 1 [-9] No answer: 235 [-9] No answer -9 ISSP e_cp_care NA
v8 Q2b Mother or father better suited to look after children 2 [-8] Can't choose: 783 [-8] Can't choose -8 ISSP e_cp_care NA
v8 Q2b Mother or father better suited to look after children 3 [1] Mothers are much better suited: 6108 [1] Mothers are much better suited 1 ISSP e_cp_care 1
v8 Q2b Mother or father better suited to look after children 4 [2] Mothers are somewhat better suited: 9857 [2] Mothers are somewhat better suited 2 ISSP e_cp_care 2
v8 Q2b Mother or father better suited to look after children 5 [3] Mothers and fathers are equally suited: 28215 [3] Mothers and fathers are equally suited 3 ISSP e_cp_care 3
v8 Q2b Mother or father better suited to look after children 6 [4] Fathers are somewhat better suited: 386 [4] Fathers are somewhat better suited 4 ISSP e_cp_care 4
v8 Q2b Mother or father better suited to look after children 7 [5] Fathers are much better suited: 178 [5] Fathers are much better suited 5 ISSP e_cp_care 5
Optional

It might be useful to export the crosswalk table as a spreadsheet since it serves as a reference document that visualises the connection between the source and harmonised data set.

write.xlsx(issp_cwt, paste("data/",  target_var_hrms, "_cwt_issp.xlsx", sep = ''))

 

2.6. Recode survey data using the crosswalk table

We first convert the wide data format to a long data format, and then merge survey data with the crosswalk table information.

issp_small_long <- issp_small %>%
  mutate(across(everything(), as.character)) %>%
  pivot_longer(cols = c(v8, c_alphan),
               names_to = "var_source", values_to = "value_source")

This is how the first six rows of the issp_small_long should look like:

CASEID DWEIGHT_COM PSWEIGHT WEIGHT_COM caseid var_source value_source
2022000400000001 1.21009284756671 0.627507713655806 0.170446723257307 1 v8 3
2022000400000001 1.21009284756671 0.627507713655806 0.170446723257307 1 c_alphan AT
2022000400000002 1.21009284756671 1.52946302414449 0.853289811813961 2 v8 2
2022000400000002 1.21009284756671 1.52946302414449 0.853289811813961 2 c_alphan AT
2022000400000003 1.64920260693779 2.39399964341258 3.13991467610981 3 v8 3
2022000400000003 1.64920260693779 2.39399964341258 3.13991467610981 3 c_alphan AT

Now we use left_join() to recode source values according to the crosswalk table, issp_cwt.

issp_hrmsd <- issp_small_long %>%
  left_join(issp_cwt, by = c("value_source" = "value_code", "var_source")) %>% 
  select(-c(npos, value_n)) %>% 
  mutate(target_value = as.character(target_value)) %>% 
  pivot_wider(
    id_cols = c(CASEID, caseid, survey, PSWEIGHT, WEIGHT_COM, DWEIGHT_COM),    # Columns to keep as unique identifiers
    names_from = target_var,      # Column that will become the new column names
    values_from = target_value         # Column containing the values for those new columns
  ) %>% pivot_longer(
    cols = all_of(target_var_hrms), 
    names_to = "target_var", values_to = "target_value") %>% 
  rename(caseID_source = CASEID)

ISSP data is ready for harmonisation. This is how the first six rows of the issp_hrmsd should look like:

head(issp_hrmsd) %>%
  kable(row.names = FALSE) %>%
  kable_styling(full_width = FALSE, bootstrap_options = c("striped", "hover"))
caseID_source caseid survey PSWEIGHT WEIGHT_COM DWEIGHT_COM country_source target_var target_value
2022000400000001 1 ISSP 0.627507713655806 0.170446723257307 1.21009284756671 AT e_cp_care 3
2022000400000002 2 ISSP 1.52946302414449 0.853289811813961 1.21009284756671 AT e_cp_care 2
2022000400000003 3 ISSP 2.39399964341258 3.13991467610981 1.64920260693779 AT e_cp_care 3
2022000400000004 4 ISSP 1.05729734002703 2.90590865844579 1.64920260693779 AT e_cp_care 2
2022000400000005 5 ISSP 0.460083891008587 0.530511579726764 0.675290739005465 AT e_cp_care 3
2022000400000006 6 ISSP 0.562435640746738 0.638415869615942 0.675290739005465 AT e_cp_care 3
Optional

At this step, the prepared data can be exported as an Rdata file and saved for later re-use.

saveRDS(issp_hrmsd, paste("data/",  target_var_hrms, "_issp.rds", sep = ''))

 

3. Harmonisation

With the following steps we will create the harmonised Care for Children: Mother or Father data.

 

3.1. Standardise country names & apply labels

There are functions specifically written to standardise country names and apply labels. Please download the R file containing these functions here . Then save this file in the R project folder and import it into the R project via source("func_recoded_country.R").

How-to

If you cannot download the R-file, please open a new file in your R-Studio project under File -> New File -> R Script and copy the text from the func_recoded_country-file into this new file. Make sure that you save this new file in your project folder under the name “func_recoded_country.R”.

source("func_recoded_country.R")
issp_1 <- issp_hrmsd %>%
 recoded_country("country_source") %>%
 country_new_labels("country_new") %>%
 func_country_sample("country_source") %>%
 country_source_recoded_labels("country_source_recoded")

eb_1 <- eb_hrmsd %>% 
  recoded_country("country_source") %>%
  country_new_labels("country_new") %>%
  func_country_sample("country_source") %>%
  country_source_recoded_labels("country_source_recoded")
Check

You can run the following code to check the country variable:

table(eb_hrmsd$country_source, eb_1$country_new)

 

3.2. Weights

For details on decisions and procedures for including weight variables, please see the Make It Equal! data documentation page, section Weight Variables.

issp_fnl <- issp_1  %>% mutate(w1_design = DWEIGHT_COM ,
                               w2_poststr = PSWEIGHT, 
                               w3_combined = as.numeric(WEIGHT_COM))

eb_fnl <- eb_1 %>% mutate(w1_design = v11,
                          w2_poststr = v11, 
                          w3_combined = as.numeric(w2_poststr))

 

3.3. Import additional information about the source data sets

This file, including additional information, can be downloaded here . Please save it into the “data” folder you generated previously.

add_data <- read_excel("data/from_doi_links_equal.xlsx") %>% 
  select(-studyno_source, -wave)

 

3.4. Combine all data

commons <- c("caseID_source", "caseid", "survey",
             "target_var","target_value","year", "country_new", "country_source_recoded",
             "w1_design", "w2_poststr", "w3_combined")

issp_fnl$year <- "2022"
eb_fnl$year <- "2003"
  
all_comb <- bind_rows(issp_fnl[, commons],
                      eb_fnl[, commons]
) %>% 
  left_join(add_data, by = c("target_var", "survey", "year")) %>%
  mutate(
    ## variables To Be Added
    studyno_I4NG = NA,
    version_I4NG = NA,
    doi_I4NG = NA,
    caseID_I4NG = paste(survey, year, country_new, caseid, sep = ''),
    #country_year
    country_year = paste(country_new, year, sep = '_'),
    # caseID = NA,
    caseID = row_number(),
    
    # code the lengths of response scales in each project
    npoints = ifelse(survey == "ISSP", 5, 2)
  ) %>%
  # Rename to avoid SPSS duplicate name error
  rename(caseid_sw = caseid, country_I4NG = country_new )
Check

Let’s check the data set:

head(all_comb) %>%
  kable(row.names = FALSE) %>%
  kable_styling(full_width = FALSE, bootstrap_options = c("striped", "hover"))
caseID_source caseid_sw survey target_var target_value year country_I4NG country_source_recoded w1_design w2_poststr w3_combined title_source doi_source studyno_I4NG version_I4NG doi_I4NG caseID_I4NG country_year caseID npoints
2022000400000001 1 ISSP e_cp_care 3 2022 AT AT 1.21009284756671 0.627507713655806 0.1704467 Family and Changing Gender Roles V https://doi.org/10.4232/5.ZA10000.2.0.0 NA NA NA ISSP2022AT1 AT_2022 1 5
2022000400000002 2 ISSP e_cp_care 2 2022 AT AT 1.21009284756671 1.52946302414449 0.8532898 Family and Changing Gender Roles V https://doi.org/10.4232/5.ZA10000.2.0.0 NA NA NA ISSP2022AT2 AT_2022 2 5
2022000400000003 3 ISSP e_cp_care 3 2022 AT AT 1.64920260693779 2.39399964341258 3.1399147 Family and Changing Gender Roles V https://doi.org/10.4232/5.ZA10000.2.0.0 NA NA NA ISSP2022AT3 AT_2022 3 5
2022000400000004 4 ISSP e_cp_care 2 2022 AT AT 1.64920260693779 1.05729734002703 2.9059087 Family and Changing Gender Roles V https://doi.org/10.4232/5.ZA10000.2.0.0 NA NA NA ISSP2022AT4 AT_2022 4 5
2022000400000005 5 ISSP e_cp_care 3 2022 AT AT 0.675290739005465 0.460083891008587 0.5305116 Family and Changing Gender Roles V https://doi.org/10.4232/5.ZA10000.2.0.0 NA NA NA ISSP2022AT5 AT_2022 5 5
2022000400000006 6 ISSP e_cp_care 3 2022 AT AT 0.675290739005465 0.562435640746738 0.6384159 Family and Changing Gender Roles V https://doi.org/10.4232/5.ZA10000.2.0.0 NA NA NA ISSP2022AT6 AT_2022 6 5
distinct(all_comb, target_var, survey, year)
# A tibble: 2 × 3
  target_var survey year 
  <chr>      <chr>  <chr>
1 e_cp_care  ISSP   2022 
2 e_cp_care  EB     2003 

 

3.5. Find equivalents of the response categories

Harmonised response categories are 1: Yes, 2: No, 3: Mothers and fathers are equally suited. The EB variable is dichotomous; therefore, in the harmonised data, category 3 is occupied only by ISSP data. They can as well be coded to the “no” category or taken out entirely. EB 2003 do not have data for Iceland and Norway. Those cases are recoded into -999. Please note that e_cp_care is an example of a rather rough harmonisation approach. However, for some users, the data might be useful anyway.

all_hrmsd <- all_comb %>%
  mutate(value_hrmsd = case_when(survey == "ISSP" & target_value %in% c("1", "2") ~ "1",
                                 survey == "ISSP" & target_value == "3" ~ "3",
                                 survey == "ISSP" & target_value %in% c("4", "5") ~ "2",
                                 survey == "EB" & target_value == "9" ~ "-999",
                                 TRUE ~ target_value)) %>%
  rename(var_hrmsd = target_var) %>%
  select(-var_hrmsd, -value_hrmsd, var_hrmsd, value_hrmsd, -caseID, caseID, -ends_with("_source"), ends_with("_source"), -target_value, -npoints)%>%
  pivot_wider(
    id_cols = c(doi_source, title_source, caseID_source, caseid_sw, survey, country_I4NG, country_source_recoded, year, country_year, 
                w1_design, w2_poststr, w3_combined, caseID_I4NG),    
    names_from = var_hrmsd,      # Column that will become the new column names
    values_from = value_hrmsd # Column containing the values for those new columns
    )

Now the harmonised Care for Children: Mother or Father data are ready. This is how the first six rows of the all_hrmsd should look like:

doi_source title_source caseID_source caseid_sw survey country_I4NG country_source_recoded year country_year w1_design w2_poststr w3_combined caseID_I4NG e_cp_care
https://doi.org/10.4232/5.ZA10000.2.0.0 Family and Changing Gender Roles V 2022000400000001 1 ISSP AT AT 2022 AT_2022 1.21009284756671 0.627507713655806 0.1704467 ISSP2022AT1 3
https://doi.org/10.4232/5.ZA10000.2.0.0 Family and Changing Gender Roles V 2022000400000002 2 ISSP AT AT 2022 AT_2022 1.21009284756671 1.52946302414449 0.8532898 ISSP2022AT2 1
https://doi.org/10.4232/5.ZA10000.2.0.0 Family and Changing Gender Roles V 2022000400000003 3 ISSP AT AT 2022 AT_2022 1.64920260693779 2.39399964341258 3.1399147 ISSP2022AT3 3
https://doi.org/10.4232/5.ZA10000.2.0.0 Family and Changing Gender Roles V 2022000400000004 4 ISSP AT AT 2022 AT_2022 1.64920260693779 1.05729734002703 2.9059087 ISSP2022AT4 1
https://doi.org/10.4232/5.ZA10000.2.0.0 Family and Changing Gender Roles V 2022000400000005 5 ISSP AT AT 2022 AT_2022 0.675290739005465 0.460083891008587 0.5305116 ISSP2022AT5 3
https://doi.org/10.4232/5.ZA10000.2.0.0 Family and Changing Gender Roles V 2022000400000006 6 ISSP AT AT 2022 AT_2022 0.675290739005465 0.562435640746738 0.6384159 ISSP2022AT6 3

 

3.6. Export data

# Rdata
saveRDS(all_hrmsd, paste("data/",  target_var_hrms, "_hrmsd.rds", sep = ''))

# SPSS file
write_sav(all_hrmsd, paste("data/",  target_var_hrms, "_hrmsd.sav", sep = ''))

# STATA file
write_dta(all_hrmsd, paste("data/",  target_var_hrms, "_hrmsd.dta", sep = ''))

# CSV file
write.csv(all_hrmsd, paste("data/",  target_var_hrms, "_hrmsd.csv", sep = ''), row.names = F, quote = T)

 

Summary

Care for Children: Mother or Father was administered in EB 2003 and ISSP 2022. Our script, first, prepares these two data sets for harmonisation so that they are consistent in format via codebooks and crosswalk tables. Then, the response categories were recoded. After this step, the item is ready for subsequent analysis!

To go back to the Make it Equal! Toolbox page, please click here!

Back to top

References

Kołczyńska, M. (2022). Combining multiple survey sources: A reproducible workflow and toolbox for survey data harmonization. Methodological Innovations, 15(1), 62–72. https://doi.org/10.1177/20597991221077923
R Core Team. (2024). R: A language and environment for statistical computing. R Foundation for Statistical Computing. https://www.R-project.org/
RStudio Team. (2023). RStudio: Integrated development environment for R. https://www.rstudio.com/

© EU Funded Project 101131118 — Infra4NextGen

 

Subject to Terms of Use | Privacy notice | Cookie policy | Built with R and Quarto