General Instructions for Opening an Extract on Your PC
The IPUMS extract system does not provide data in the format of any particular statistics package. Instead, we provide raw ASCII data files and the command files necessary for reading the raw data into whichever statistical program you specify in Step 1 of the extract process (either SPSS, Stata, or SAS).
SPSS Users
On the Extract Download page, you will see your extract requests along with the dates of the requests, descriptions of the requests, and three links on the right side of the page: data, codebook, and SPSS.
The first step is downloading and decompressing the data "dat.gz" file. First, right click on the "data" link and select "Save Link As". Next, decompress the dat.gz file noting to which directory you save your decompressed data ".dat" file.
The next step is reading the data file into SPSS, for which we have provided an SPSS command file. From the Extract Download page, you need to right click on the SPSS link and select "Save Link As" or "Save Target As."
Open the SPSS command file in SPSS. You need to change the first line of the ".sps" command file to indicate the location of the ".dat" file on your computer. If your IPUMS files are called trent001.sps and trent001.dat, then the first line of the ".sps" file will read:
data list file ='trent001.dat'/
If the ".dat" data file is on your C drive, for instance, you need to change that line to:
data list file ='C:\trent001.dat'/
After making this change, pull down the "Run" menu and select "All". SPSS will then read in your data.
STATA Users
On the Extract Download page, you will see your extract requests along with the dates of the requests, descriptions of the requests, and three links on the right side of the page: data, codebook, and STATA.
The first step is downloading and decompressing the data "dat.gz" file. First, right click on the "data" link and select "Save Link As". Next, decompress the "dat.gz" file noting to which directory you save your decompressed ".dat" data file.
The next step is reading the data file into STATA, for which we have provided a STATA ".do" command file. From the Extract Download page, you need to right click on the STATA link and select "Save Link As" or "Save Target As." Be sure to save the STATA ".do" command file in the same directory as you saved the decompressed ".dat" data file.
Now you are ready to read the data into STATA. Upon opening STATA, you will need to be sure STATA is pointing to the directory that contains the ".dat" data file and the ".do" command file. If these files are in a folder called ‘IPUMS’ on your C drive, for instance, you should type:
cd "C:\IPUMS\"
Next, you will need to execute the ".do" file. In the case that this file is named "trent001.do", you will need to type:
do trent001.do
You will see ‘end of do-file’ when STATA has finished reading in the data.
SAS Users
On the Extract Download page, you will see your extract requests along with the dates of the requests, descriptions of the requests, and three links on the right side of the page: data, codebook, and SAS.
The first step is downloading and decompressing the data "dat.gz" file. First, right click on the "data" link and select "Save Link As". Next, decompress the "dat.gz" file noting to which directory you save your decompressed ".dat" data file.
The next step is reading the data file into SAS, for which we have provided a SAS command file. From the Extract Download page, you need to right click on the SAS link and select "Save Link As" or "Save Target As."
Open the SAS command file in SAS. Use the "Find" function under the "Edit" Menu and search for the phrase "IPUMS USER." As the note in this portion of the command file indicates, you need to change two of the lines in your SAS command file to indicate the location of the ".dat" data file on your computer. If your IPUMS files are called trent001.sas and trent001.dat, then the three lines below the "IPUMS USER" notes in the ".sas" command file will read:
libname ipumsdat '<insert path to folder containing data file here>';data ipumsdat.trent001;
infile '<insert path to folder containing data file here>trent001.dat';
If the ".dat" data file is in a folder on your C drive called IPUMS, for instance, then you need to change those lines to:
ipumsdat 'C:\IPUMS';
data ipumsdat.trent001;
infile 'C:\IPUMS\trent001.dat';
After making these changes, pull down the "Run" menu and select "Submit." SAS will then read in your data.
R Users
Open RStudio. Change your working directory to the location containing your ".dat" and ".xml" files manually or by typing
setwd("C:\IPUMS\")
If you haven't already installed the ipumsr package, install it with install.packages('ipumsr')
. Then run the .R file downloaded from IPUMS to load your extract into R. Alternatively, you can do load your extract manually with the following code.
library('ipumsr')
ddi <- read_ipums_ddi("cps_00001.xml")
data <- read_ipums_micro(ddi)
When R is finished reading the data, you will see an object named "data" in your global environment.