*! version 0.1 17oct2016

Title

readSHARE -- Read SHARE data for analysis

Syntax

readSHARE
varlist
[, options]

Main
waves(str) select the wave(s) from which to extract the data;
default is waves(5). It is possible to extract data from multiple waves at once by providing wave numbers
separated by space.

Data options
descTab create a description table for the requested variables; with this option no SHARE data is extracted

module(str) limit the modules from which variables are extracted; by default all modules are considered

prefix(str) set prefix for the extracted variables

wide load multiple wave data into wide format; by default data extracted in long format

imputations allow extraction of variables from GV_IMPUTATIONS module

cv_r keep all observations when loading variables from CV_R module

xt load variables from the XT module

mergeBy(str) set variables as identifiers for merging data from different modules; by default mergeid is used

Data imputations
hhres(str) indicate variables with values present only for the household respondent and impute for all household members

finres(str) indicate variables with values present only for the financial respondent and impute for all household members

famres(str) indicate variables with values present only for the family respondent and impute for all household members

long(str) indicate variables with values present in earlier waves in case of longitudinal questionnaire

Description

readSHARE is a tool to easily select and read variables from the
SHARE dataset into a single .dta file.
It also allows for a straightforward automation of typical operations on SHARE variables in particular
imputing observations for various types of questions and extracting longitudinal information
from previous waves.

The varlist provides variable names to be extracted from SHARE data. The program uses regular expressions
to select the variables, so it is possible to use wildcards (e.g. ? and * signs) for variable names to be
extracted. Using this method it is also possible to extract groups of variables.

If a badly specified variable is given as input the program does not produce an error, however
it reports variables which have not been found in the data.
Data from different modules are merged by default by mergeid.
variables from the GV_IMPUTATIONS, CV_R and XT modules are extracted only after explicitly
declaring appropriate options.

While readSHARE cleans the memory every time it is used, addSHARE can be used to add additional variables
to those already existing in memory. addSHARE has the same syntax and options as readSHARE.

Setup

For the program to run it needs to have specified directories (as globals) for the description table and SHARE data.

The description table is a Stata .dta file containing variable names, module names
and variable labels for all the variables present in SHARE datasets in all waves. Creating the description table
is a necessary requirement to run readSHARE and addSHARE.

The description table can be created out of SHARE data using the command createSHAREDesc and needs to be saved
in a user specified location.

It is important to keep the given directory structure and module names as in the official SHARE release.

Example:

global w1Dir "$/sharew1_rel5-0-0_ALL_datasets_stata/"

global w2Dir "$/sharew2_rel5-0-0_ALL_datasets_stata/"

global w3Dir "$/sharew3_rel5-0-0_ALL_datasets_stata/"

global w4Dir "$/sharew4_rel5-0-0_ALL_datasets_stata/"

global w5Dir "$/sharew5_rel5-0-0_ALL_datasets_stata/"

global w6Dir "$/sharew6_rel0_ALL_datasets_stata/"

global shareDesc "$/shareDescStata.dta"

Options

Main

waves() indicates which wave of SHARE to extract the data from. To read data from multiple waves it is possible to provide
multiple numbers in the option, separated by space. By default the data is loaded into a long format with an additional variable
wave created containing the wave number for each observation. It is possible to load the data into wide format using the wide option.

Data options

descTab generates variable description table, does not load the data.
Creates a table indicating which variables are extracted with full variable names, labels and specifying module and wave information.

imputations allows loading of multiple imputations from the imputed data files.
By default it is not possible to extract variables from the GV_IMPUTATIONS module.
This module contains multiple imputations (5 per respondent) for each mergeid. The default set up does not allow imputed
variables to be extracted to avoid erroneous use of multiple observations. The user needs to specify that imputed variables are to be extracted.
The variable implicat identifying each imputation is automatically added to the list of extracted variables.

mergeBy selects variables by which modules are merged, mergeid is set as default.

module extracts variables only for selected modules. This option might be useful to selectively draw
variables which may be present in more than one module (e.g. bmi in GV_HEALTH and GV_IMPUTATIONS)

prefix adds prefix for all selected variables with the exception of mergeid and implicat.

cv_r keeps all observations from the CV_R module when extracting a variable from that module.
By default the program keeps only data for persons eligible for the SHARE interview. End-of-life interviews
are excluded by default. It is possible to load them using the xt option.
Using this option allows to read observations for all household members for variables from the CV_R.

wide loads data from multiple waves in the wide format if multiple waves are selected in the waves() option.
When no prefix() is provided wave number is indicated with w wwave_ prefix for each of the extracted
variables. When the prefix()
option is not empty the prefix is constructed as prefix_wave_.

End-of-life interview data

xt allows to load data from the XT module. It also provides the possibility to merge this data with other modules.
When using data from the end-of-life interview it is problematic to work with XT variables form multiple waves since
for a given wave the observations exist only in the CV_R and XT modules. Loading longitudinal data is problematic
due to the fact that the mn101_ indicating whether the respondent received a longitudinal version of
the questionnaire is not specified in the wave in which the end-of-life interview was conducted.

Merging with other data is possible only in the wide format when using the xt option. In this way
values from previous waves can be assigned to the XT respondent in the wave of the end-of-life interview.
Including imputations is also possible.

Data imputation

hhres assigns household respondent's answers to all household members.
Useful for household-level questions answered only by the household respondent.

famres assigns family respondent's answers to all household members.
Useful for family level questions answered only by the family respondent.

finres assigns financial respondent's answers to all household members.
Useful for family level questions answered only by the financial respondent.
For wave 1 does not assign family respondent's answers if separate finances are indicated.

long assigns values from earlier waves if the respondent was given the longitudinal version
of the questionaire and the specific question is asked only in the baseline version.
New values are extracted from earlier waves only in case of missing values in the specified wave.
An additional variable is created (long_info_*) indicating whether the variable had non-missing
values in each wave.

Remarks

The programs are dedicated to work with the Survey of Hearlth, Ageing and Retirement in Europe (SHARE) data:

Börsch-Supan, A., Brandt, M., Hunkler, C., Kneip, T., Korbmacher, J., Malter, F., Schaan, B., Stuck, S. and Zuber, S. (2013). Data Resource Profile: The Survey of Health, Ageing and Retirement in Europe (SHARE). International Journal of Epidemiology DOI: 10.1093/ije/dyt088.

The SHARE dataset can be obtained from the official SHARE website.
The current version of the programs use the 6.0.0 release version of the SHARE data.

In case of questions or errors please contact:

Mateusz Najsztub: mnajsztub@cenea.org.pl.

Examples

Extract all variables from PH module in wave 5.

. readSHARE *, w(5) mod(ph)

Extract some variables from wave 4 and save them with prefix w4_.

. readSHARE interview *_resp mergeidp hh0* co2*, w(4) p(w4_)

Extract variables specifically from the gv_imputations module.

. readSHARE interview bmi weight height, w(5) imp mod(gv_imputations)

Add CO207_ variable from wave 5 and impute answers for household members.

. addSHARE interview country , w(5) hh(co207)

Add CF001_ variable from wave 5 and impute missing values from earlier waves.

. addSHARE cf001, w(5) long(cf001)

Read CF001_ with country and age variables from waves 1-5 (wo. 3) and impute missing values from
earlier waves. Load the data in long format.

. readSHARE country age_int cf001, w(1 2 4 5) long(cf001)

Read CF001_ with country and age variables from waves 1-5 (wo. 3) and impute missing values from
earlier waves. Load the data in wide format.

. readSHARE country age_int cf001, w(1 2 4 5) long(cf001) wide

Working with XT data

Read the XT data from waves 2,4 and 5.

. readSHARE xt*, w(2 4 5) xt

Add cf001_ from earlier waves with values imputed from earlier waves for each wave.

. addSHARE cf001, w(1 2 4 5) long(cf001) xt

Add sp008_ from earlier waves and impute values for non-family respondents.

. addSHARE sp008, fam(sp008) w(1 2 4 ) prefix(fam_) xt