|
Converting SAS Data Files into Other Formats
(by Amy Yuen)
This guide picks up where the guides on transferring ICPSR data
into SAS leave off. As with the ICPSR-SAS guide, this guide is intended for users who have data in a
SAS format but are not familiar with SAS and wish to analyze that data in another stats package. It will show
users how to use StatTransfer to convert their SAS files into other formats such as SPSS or Stata. Because of
how SAS handles value labels (i.e. it saves them in a separate file called a catalog file), the process here
has a few more steps involved than is usually the case when converting files in StatTransfer. This guide was
written for use with StatTransfer 8. The procedure for StatTransfer 7 is slightly different - read
here for more detail.
(1) Click on the StatTransfer icon on the desktop or select the program from the Start Menu; StatTransfer's
default menu (the "transfer dialog box") will appear. For "Input File Type," select "SAS." [Note - do not select
"SAS for Unix" or "SAS Transport File."] Under "File Specification," type the file path to your SAS data file or
browse using the "Browse" button on the right (in this case, our SAS data file is saved at
C:\patrons\ICPSR\3966).
Next, in the "Output File Type" box, select the file into which you want to convert the SAS data (in this case, we
have chosen to transfer the SAS file into SPSS for Windows). The "File Specification" box allows users to choose
where to save the output file. By default, StatTransfer will (I) assign the name that the SAS file has to the new
file but with the proper extension (e.g. *.sav for SPSS, *.dta for Stata) and (II) save it in the same directory
as the original SAS file unless you specify otherwise.

Click here for full-size image
(2). Next, select the "Options (3)" tab at the top of the StatTransfer window. Here, we have two options for
how to proceed - we can tell StatTransfer to read the value labels from a catalog file [Option (a) below], or
from a SAS datafile [Option (b) below].
Either option will, in theory, produce the same results, but we will review both of them here. If you want your
new SPSS or Stata file to have value labels, however, you will have to choose one or the other of them.
(a) In the box labeled "SAS Value Labels", check the circle for "Read formats directly from catalog file." In
the "Filename" box, type the file path and name of the *.sas7bcat file you created when you read the raw ICPSR
data into SAS, or that should accompany the SAS files. [Remember that .sas7bcat is the extension for SAS catalog
files.] If there is no *.sas7bcat file associated with the data file, see the tutorial explaining
how to read ICPSR data into SAS before proceeding here. (The
other options and settings here can be left as is.)

Click here for full-size image
OR
(b) In the box labeled "SAS Value Labels", check the circle "Read formats from a SAS datafile." In the "Filename"
box, type the file path to the *_fmts.sas7bdat file you created when you read the raw ICPSR data into SAS. If
there is no *_fmts.sas7bdat file associated with the data file, see the tutorial explaining
how to read ICPSR data into SAS before proceeding here. (The
other options and settings here can be left as is.)

Click here for full-size image
(3). When you have specified the source for the value labels, click on the "Transfer" tab to return to the
transfer dialog box. Then click the "Transfer" button in the lower left. The datafile should appear in the
directory specified in the "File Specification" box for the output file:

Click here for full-size image
When opening up your new data file in SPSS or Stata, you may notice that the variable labels did not carry over.
If this happens, you need to run the transfer in StatTransfer again exactly as show above. Check the file size of
your data file before and after you run the transfer a second time. It should be larger the second time around
(note here that the SPSS files we created here was 836KB after the first transfer and was 892KB after the second
transfer, for instance):

Click here for full-size image
If you have any questions or would like extra assistance, please feel free to
contact the Data Center staff.
|