Cornell University Cornell University CISER

CISER Computing

Reading ascii files with no filename extension into Stata

Q.   I get the following error when trying to read a particular dataset from the CISER Data Archive, even though I’m certain I have the pathname correct.  What is the problem?

file V:\he\104\da6847.raw not found

A.   As a shortcut, many Stata commands (such as use, save, insheet, outsheet, infile, outfile and infix) add a default extension to file names that lack one.

For example, if you type:

infix var1 1-6 var2 7-9 using filename

then Stata will assume that you are referring to filename.raw.

Many ASCII files in the CISER Data Archive have no file extension at all. To prevent Stata from adding the default file extension to these, simply add a period to the end of the file name.

For example, if you wish to read the first two variables from the 1993 Natality Detail File, use:

infix year 1-4 rectype 5 using V:\he\104\da6847.

If you omit the period, Stata will look in vain for V:\he\104\da6847.raw and return the error message above.