Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
readSHARE setup for Stata
// Instructions for setting up readSHARE in Stata
// What is readSHARE?
view browse "https://ideas.repec.org/c/boc/bocode/s458405.html"
// 2.1. Load all the waves that you want to use in the same folder
* In other words, all folders containing the data for a SHARE wave should be found following the same path , for example under "C:/Users/JohnSmith/Documents/SHARE"
* Remember to extract the zip-files.
* We recommend you download all waves at once
// 2.2. Download readSHARE
ssc install readSHARE
// 2.3. Create the following macros
global sData "C:/YOUR_DIRECTORY" // NB! Insert your path here
global shareDesc "${sData}/shareDescStata.dta"
global w1Dir "${sData}/sharew1_rel7-0-0_ALL_datasets_stata/"
global w2Dir "${sData}/sharew2_rel7-0-0_ALL_datasets_stata/"
global w3Dir "${sData}/sharew3_rel7-0-0_ALL_datasets_stata/"
global w4Dir "${sData}/sharew4_rel7-0-0_ALL_datasets_stata/"
global w5Dir "${sData}/sharew5_rel7-0-0_ALL_datasets_stata/"
global w6Dir "${sData}/sharew6_rel7-0-0_ALL_datasets_stata/"
global w7Dir "${sData}/sharew7_rel7-0-0_ALL_datasets_stata/"
// NB! Run the above global macros every time you use readSHARE
*Alternatively you can copy the macros in the profile.do file. That way the macros are active upon startup of Stata
*Profile.do file is created or located in your "personal" folder, the path of which can be found using the command
personal
// 2.4. Finally create a file containing the metainfo and save it
createSHAREDesc, sDir(${sData})
cap n save ${shareDesc}, replace
// 2.5. Congratulate yourself for the good work when the following command opens the PH-module of wave 7
readSHARE *, w(7) mod(ph)
// 2.6. Also get familiar with the full functionalities of readSHARE
help addSHARE
help readSHARE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.