Tutorial demonstrating how to load SDA data for use in STATA.
1. In SDA
It is advisable to run this procedure on a few selected variables the first time around in order to identify any errors easily.
1.1 Save the data file as data.txt, the Stata file as stata.txt, and the codebook file as codebook.txt
1.2 From file explorer, rename the Stata file as stata.do
2. Start Stata
2.1 Click on Window → Do-file Editor → New Do-file Editor
2.2 From the Do-file Editor window, click on File → Open → Open → browse for stata.do file
2.3 If you scroll to the middle of the do-file page, you will find the dictionary line.
3. Start Notepad++
3.1 In the do-file, from the dictionary line all the way to the bottom, cut and paste into a new document in Notepad++ or another text editor and save as .dct (eg. dictionary.dct)
3.2 In the dictionary.dct file, replace Y with the full path in double quotes to your data file (e.g. "C:\full path\data.txt").
3.3 At the botom of the page, after the closing curly brackets (i.e, "}"), add a period (i.e, ".") on a new final line. Then save this file.
4. Return to Stata
4.1 In the do-file, replace X with the full path to your .dct file (e.g. "C:\full path\dictionary.dct") and save it
4.2 Highlight the code in the do-file and click on execute (short-cut: CTRL-R). This step will generate your data set.
4.3 Save your data file as a system file (.dta).
Once you have generated your data set, you can compare the expected number of observations and variables to those indicated on the CHASS files download page.
Submitted by estherkim on Mon, 12/02/2013 - 13:14. Updated 08/05/2019 by nadiamuhe.