I cannot seem to extract a .dta.gz file and import it into R. The zipped file is about 100MB. Whether I unzip it using WinGZip and then import the actual .dta file into R, or try to unzip the whole file in R, I always end up getting an error that says ''not a Stata version 5-12 .dta file''.
Does anyone have any ideas about how to extract this file so that R will be able to read it?
The .dta files created by our extract system are formatted for Stata version 13. It appears the method you are using to import into R requires a .dta file intended for an older version of Stata. You might try the readstata13 package for R.
IPUMS data are delivered as a compressed file (a Stata file would be *.dta.gz). You will need to decompress or unzip them before using them. I recommend 7zip as a free decompression software for Windows; the Archive Utility on a Mac will take care of this as well. Please let me know if decompressing the data file does not address this issue.
I’m having an issue unzipping a .dat.gz file on my Mac. The error I get is “Error 79 - Inappropriate file type or format”. This is a recent issue, I was able to unzip files from IPUMS a couple of months ago. I appreciate any suggestions.
By default, data are delivered as fixed-width text files (.dat extension). This file type can be read into Stata with the accompanying .do file delivered with your data extract (see screenshot below). Alternatively, you can request a data file that is formatted for Stata by clicking on the “Change” option in the Data Format row of your extract summary/definition page (see second screenshot).
Screenshot 1: Command file for reading fixed width data-set into Stata highlighted below.