Presentation is loading. Please wait.

Presentation is loading. Please wait.

Using a set-up file to read ASCII data into Stata

Similar presentations


Presentation on theme: "Using a set-up file to read ASCII data into Stata"— Presentation transcript:

1 Using a set-up file to read ASCII data into Stata
This is a tutorial for reading data into Stata. This tutorial presumes that you have selected a study that works for your project and that it has a set-up file to read the data into Stata.

2 Drag and drop the data, dictionary, and set-up files to the desktop.
The first step is to remove the files from the zip folder that are needed to read in the data. Double-click on the icon to open the folder. Look for the file that ends with “.do.” This is the set-up file. The other two files that are needed are the “data.txt” file, and the dictionary file, which ends with “set-up.dct.” Simply drag and drop these files to the desktop. When using a study with multiple dataset, be sure to use the Set-up, Data, and Dictionary files that have the same dataset number.

3 Modify the set-up file in WordPad.
The next step is to modify the Set-up file. To open the Stata set-up file, right-click on the icon and select the OPEN WITH option and select WordPad. Or launch WordPad from the Start menu and point to this file on the desktop. The first command is “set mem”. This line tells Stata how much available RAM to use running this file. A large dataset may require that the default, 6 mg, be increased. When using the INTERCOOLED version, the study size should be checked. Some ICPSR studies are very large and may not run with this version.

4 Right-click on data file’s icon. Select Properties.
To display the box, put the cursor on the icon and right-click. Go to Properties. And left-click. Set the box next to WordPad. Look for the section that begins with Local raw_data “DATA-FILENAME” Each line in this section must have the place-holder, seen here with quotation marks, replaced with the location of the actual files. Edit DATA-FILENAME by replacing it with information from the Data file’s Properties Box. Highlight only DATA-FILENAME.

5 Edit “Data-filename” with the location of the data
Click on the Properties Box and go to the line, “Location.” Select the text and copy it. Click on WordPad and, as DATA-FILENAME is already highlighted, paste over it. Then, add a backslash.

6 Add data file’s name to data location.
Now, we need to add the filename. Go back to the Properties Box. At the top, find the notepad icon. The name of the file is next to the icon. Select and copy the filename. Click on WordPad. As the cursor is still in the line being edited, we can paste it right in. Close the Data.txt file’s Properties Box.

7 Repeat the process for dictionary file.
Make the same change to the next line.

8 Display Dictionary file’s properties box.
This time, edit DICTIONARY-FILENAME, with information from the Dictionary file’s Property Box. Highlight only DICTIONARY-FILENAME

9 Edit “dictionary-filename” in location.
.Click on the Properties Box and go to the line, “Location.” Select the text and copy it. Click on WordPad and, as DICTIONARY-FILENAME is already highlighted, paste over it. Then, add a backslash.

10 Add Dictionary file name to location.
Next, add the filename. Go back to the Properties Box. At the top, find the notepad icon. The name of the file is next to the icon. Select and copy the filename. Click on WordPad. As the cursor is still in the line being edited, paste it right in. Close the Data.txt file’s Properties Box.

11 Edit the location of the outfile.
The Properties Box for the Dictionary file is still open, so that the desktop path can be copied into the location of the outfile.

12 Copy and Paste Location from dictionary file’s property box into out-file’s location.
Copy the Location line, that points to the desktop, and paste it over the highlighted STATA-DATAFILE. Then add a backslash.

13 Type in a descriptive file name for the out-file.
Name the file in a descriptive manner. Here the ICPSR study number is used, “icpsr 2167.”

14 Save the edited set-up file to desktop.
Finally, save the set-up file. Here it is named “EDITED2167.setup.do” and saved to the desktop. With all of the paths defined and the output file specified, this file is ready to run.

15 Launch Stata. Run the set-up file.
From the Start menu, launch Stata. Go to File, then, DO, switch to Desktop view and select the file, “EDITED2167.setup.do”.

16 Data are analysis-ready.
When the program indicates that the requested process has been executed, the file is ready to be used.

17 To open file, start Stata, point to new system file on desktop.
To open the file next time, launch Stata from the start menu. The command line for opening the file is: “use “FILE-NAME” clear”. When data loads, the variable list will be visible, and the current status will be in the Results window.


Download ppt "Using a set-up file to read ASCII data into Stata"

Similar presentations


Ads by Google