Importing ASCII files into Stata

Importing ASCII files into Stata

by Leah -
Number of replies: 3

I'm trying to import data in the form of ASCII files from the SEER database into Stata. However the data looks just like random numbers. Is there a data dictionary or something I'm supposed to use so Stata can interpret the files? And if so, is that something I can search for, or is it something I'd have to create myself?

 

Thanks!

 

Leah

 

In reply to Leah

Re: Importing ASCII files into Stata

by Maria Chao -

Hi Leah,

I don't have direct experience with SEER but I've imported data for other large, public datasets in ASCII format. You do need a data dictionary which tells Stata how to translate the numbers in an ASCII file into variables. The National Health Interview Survey provides a data dictionary in the form of a Stata do file to define the variables. Check to see if the SEER website (or wherever you got the ASCII file from) has a readily available do file that you could use.

As an alternate solution, I came across this website that includes the SEER data in various formats, including Stata dta files:

http://www.nber.org/data/seer_u.s._county_population_data.html

I'm not sure that these data are the most current or comprehensive, but may be worth taking a look at. Certainly better than needing to develop your own data dictionary!

Maria

 

In reply to Leah

Re: Importing ASCII files into Stata

by Leah -

Sadly still struggling with importing the ASCII files into STATA. Dr. Pletcher suggested I start by doing "FIle" --> "Import" --> "Text data in fixed format" at which point I can use the information from a SEER Recoded Data PDF. However, where I am now stuck is that you have to choose a file to import and apply the recoding information to.  This looks like it should happen under "Text dataset filename," however if I choose "browse" to select the file I want, the files don't look like they can be selected. The file i want has a .TXT filename. Does that sound correct for an ASCII file? Do I need to rename the file for STATA to recognize it? Alternatively, if I change the "file format" I'm trying to import from the default ".raw" to "all" I can select the file I want, but then when I hit "open" I get the red error message "you must start with an empty dataset."

Thanks!

 

Leah

 

In reply to Leah

Re: Importing ASCII files into Stata

by Raj Kalapatapu -

Try converting the ACSII file to Stata using the Stat/Transfer program. Stat/Transfer is freely available through the UCSF MyResearch website.

Raj