PROBLEM:
    How can I get SPSS to use data originally saved in SAS?

    SOLUTION:
    As of Version 10.1, SPSS can now read SAS data sets directly, whereas before this version a SAS Transport File was necessary. Here is a summary of some of the current techniques.

    SPSS Version 10.1 and above

      SAS data sets (Version 7 of SAS and above) are stored in files with a *.sas7bdat extension. These files can now be read directly into the SPSS Data Window.

      Click File>Open>Data, then choose 'SAS Long File Name' (or other choice appropriate for your SAS data set), then locate the folder and file you want to convert so that the name of that file appears in the 'File Name' field, then click 'Open'.

      SAS Transport Files (see below) also can be converted into the SPSS Data Window (Active File) in Version 10.1 and above.

    SPSS Version 10.0.x and lower

      Older versions of SPSS traditionally required any data from SAS to be in the form of a Version 5 SAS Transport File, which is the type created by using a LIBNAME statement with the XPORT engine (not one created using PROC CPORT). This, of course, limited users to data that conformed to the old (pre-Version 7) SAS rules, with variable names of eight characters or less, and so forth.

      This type of conversion is available on all platforms running SPSS version 5 or higher. SPSS Inc. documentation (for Version 10.0) for this operation is at:

        http://www.spss.com/tech/downloads/getsas.pdf

      Following is a (very) basic example of how to create a SAS transport file using the XPORT engine. (The example assumes you have a temporary SAS data set called "MYDATA5".)

        LIBNAME  OUT1  XPORT  'sasfile.xpt';
        PROC  COPY  IN=WORK  OUT=OUT1;  SELECT  MYDATA5;
        RUN;

      Remember that SAS transport files must be moved from system to system in BINARY mode, so if the SAS transport file was created elsewhere, move it to UNIX in BINARY.

      To read in the SAS transport file created in the example above, and save it as an SPSS system (Save) file, use the following commands in your SPSS session:

        get  sas  data='sasfile.xpt'  dset(mydata5).
        save  outfile='newdata.sps'.
        execute.

      This operation also can be done using the File>Open>Data menu choices in later versions.

      The subcommand DSET(MYDATA5) is not necessary, unless the transport file contains more than one SAS data set.

    Converting SAS Formats into SPSS Value Labels

      SAS allows users to write their own format specifications to assign labels to values. (SPSS calls these 'value labels', and stores them along with data; SAS calls them 'formats', and stores them separately.) If your SAS data set has imbedded user-written format specifications, you can usually convert these types of formats into SPSS value labels by adding the FORMATS subcommand to the GET SAS command.

      First, the formats must be converted to a SAS transport file, in a process analogous to the one outlined above for SAS data sets. First, the formats must be put into a SAS data set using PROC FORMAT with the CNTLOUT= option, as in this example:

        LIBNAME  SASDATA  'C:\SASDATA';    **(or '~/sasdata'  ***;
        LIBNAME  LIBRARY  'C:\SASFMTS';    **(or '~/sasfmts'  ***; 
        PROC  FORMAT  LIBRARY=LIBRARY  CNTLOUT=SASDATA.FMTXPORT;
        RUN;

      (NOTE: It is advisable NOT to use the name FORMATS as in SASDATA.FORMATS when using the CNTLOUT= option of PROC FORMAT. This is to avoid confusion with the SAS format catalog, which is called FORMATS.SCT01)

      Next, you create another SAS transport file as you did for the data:

        LIBNAME  OUT2  XPORT  'sasfmts.xpt;'
        PROC  COPY  IN=SASDATA  OUT=OUT2;  SELECT FMTXPORT;
        RUN;

      Then, your SPSS program would look like this:

        get  sas  data='sasfile.xpt'  dset(mydata5)
          / formats='sasfmts.xpt'.
        save  outfile='newdata.sps'.
        execute.