Events
« March 2010 »
SunMonTueWedThuFriSat
123456
78910111213
14151617181920
21222324252627
28293031
Archives Search

Search UC-UTCC Archives
 

Related Websites
The Townsend Thai Project

The University of Chicago

University of the Thai Chamber of Commerce

The Interuniversity Consortium for Political and Social Research (ICPSR)

Dataverse Network Project

Printer-friendly versionSend to friendPDF version
Prepare Data

1. Download the dataset setup files from UC-UTCC Dataverse. Please follow UC-UTCC Dataverse user guide. Any question about UC-UTCC Dataverse, please contact Dataverse support email: rapeepong@dvn.utcc.ac.th

Download setup file of National Rural Development 2005 from UC-UTCC Dataverse.
 
Figure 1 Download setup file of National Rural Development 2005 from UC-UTCC Dataverse.

2. Please read and understand term of use before downloading each dataset. If you accept the term of use, make a checkbox “I agree and accept these terms of use” checked and click Continue button. Or not, click Cancel button.

Term of use
Figure 2 Term of use

3. Click Save button on the file download dialog box. And select the directory to save this file.


Save dataset setup file to local computer.

Figure 3 Save dataset setup file to local computer.

4. After downloading, you have to decompress the dataset setup files in your local computer. Figure 4 is just one of several ways to extract zip file in local computer. You can choose other solutions to extract file if you cannot follow this figure.

Extract setup file
Figure 4 Extract setup file

In Figure 4, we extract downloading file on the C drive.

5. Some dataset has a large size. So we have to separate the dataset into several parts. You don’t need to import all parts in Stata. Just import the interesting part to Stata for use.
For each part or dataset, there are many setup files and 1 ASCII data file. For Stata, we use only 3 files.
• A columnar ASCII data file (.txt)
• A Stata dictionary file (.dct)
• A Stata do-File (.do)

Setup file for National Rural Development 2005 Part 1
Figure 5 Setup file for National Rural Development 2005 Part 1

 

In Figure 5, we use these below files to import National Rural Development 2005 Part 1 (NRD2005 Part 1) to SAS. The path for reference is C:\NRD2005_setup_file\NRD2005_PART1
• NRD2005_PART1_DATA.txt
• NRD2005_PART1_setupSTATA.dct
• NRD2005_PART1_setupSTATA.do

Import data to Stata

1. Open Stata program.
2. Assign memory of RAM to Stata to receive and store the data by command
set mem allocation. Take look at Figure 6, we assign 500 megabytes of RAM to Stata.


Set memory to Stata

Figure 6 Set memory to Stata.
 

3. To open Do-file editor, Click Window -> Do-file Editor -> New Do-file

Open do-file editor
Figure 7 Open do-file editor

4. Then Do-file Editor will open. To open Stata do-file or Stata dictionary file, click menu File -> Open. Then select directory that file is located.

Do-file Editor
Figure 8 Do-file Editor
 

Note: In this case, we will open 2 files of National Rural Development 2005 Part 1 (NRD2005 Part 1) that located in C:\NRD2005_setup_file\NRD2005_PART1
• NRD2005_PART1_setupSTATA.dct
• NRD2005_PART1_setupSTATA.do

5. The Do-file will display in the editor. Now we can check and edit code before running.

Open Do-file
Figure 9 Open Do-file

6. Enter the specification path of the file as below. It is important to import data to Stata. Please ensure that is correct path.

a. Stata dictionary file:
dictionary using – the raw ASCII data file.
In this case, we change the raw ASCII data file path from NRD2005_PART1_DATA.txt
to the correct path C:\NRD2005_setup_file\NRD2005_PART1\NRD2005_PART1_DATA.txt
on NRD2005_PART1_setupSTATA.dct (See Figure 10)

Update path of the raw ASCII data file in Stata dictionary file.
Figure 10 Update path of the raw ASCII data file in Stata dictionary file.
 

b. Stata Do-file:
infile using – the Stata dictionary file
In this case, we change the dictionary file path from NRD2005_PART1_setupSTATA.dct
to the correct path C:\NRD2005_setup_file\NRD2005_PART1\NRD2005_PART1_setupSTATA.dct
in NRD2005_PART1_setupSTATA.do (See Figure 11)

Update path of the Stata dictionary file in Stata do-file.
Figure 11 Update path of the Stata dictionary file in Stata do-file.

7. To save the modification, click menu File -> Save

Save file
Figure 12 Save file.
 

8. On Stata Do-File Editor, open the Stata do-file and import data by menu Tools -> Do

Import Data with Stata Do-File Editor.
Figure 13 Import Data with Stata Do-File Editor.

9. After importing successfully, the dataset is ready for use in Stata.

the data in Stata.
Figure 14 the data in Stata.
Reference

http://www.icpsr.umich.edu/cocoon/SAMHDA/FAQ/0056.xml
http://www.icpsr.umich.edu/cocoon/SAMHDA/FAQ/0127.xml

Author: Sirivimol Thanchalatudom
Reviewer: Phongkiat Koopkan

Our Services
UC-UTCC Data Depository TSpower (Visualization System)SET Smart Enterprise