How to Bring an ASCII Data File into Stata
THE BEST WAY TO APPROACH THIS TASK
We will focus on determining the appropriate Stata "do file" needed and creating the required Stata "do file." ASCII DATA FILESASCII data files are often referred to as "text" files or "plain text" files. They contain no formatting information--just rows of characters. The “mapping” information for the characters comes from the codebook discussed in step one above. Two types
Is the ASCII Single Record or Multi-Record?
BRINGING ASCII DATA INTO STATAStata "do file" Since no structure is included in an ASCII data file, a Stata "do file" must be created to instruct the software on where to go to get particular variables (questions). Stata Commands That Every Stata "do file" Should Have
Example of a Single Record Stata "do file" (complete sample below)*this program reads a single record data file into Stata clear set more off infix Q08 50-51 Sex 98-99 using "c:\temp\abcw887.dat" label var Q08 "FBI Monitoring" label var Sex "Gender of Respondent" label define Q08l 1 "Support" 2 "Oppose" 8 "DK" 9 "NA-Refused" label values Q08 Q08l label define Sexl 1 "Male" 2 "Female" label values Sex Sexl Stata Syntax Rules
|