Converting SAS to SPSS
From: j_weedon@escape.com (Jay Weedon)
Newsgroups: comp.soft-sys.sas
Subject: Re: Converting SAS to SPSS
Date: Wed, 08 May 1996 17:32:33 GMT
Organization: Zippo
Lines: 49
czg@inforamp.net (Ray Chow) wrote:
>I found several articles on this topic in the archives, but need
>further clarification. I want to convert a file created in SAS
>(v6.04 for DOS) to SPSS. I know DBMS/COPY can do this, but will
>it translate the formats to their SPSS equivalents? Alternatively,
>can this version of SAS translate data and format catalogues into
>something SPSS can use? I can create a transport file, but how
>can I translate the formats?
Reading PC SAS Data Files & Formats into SPSS for Windows
- Under SAS, create a library defined as the output file for an
export job, e.g.:
LIBNAME SPSS XPORT 'C:\SPSS\SASXPRT1.DAT';
which creates a SAS export file called SASXPRT1.DAT in a directory
called C:\SPSS, referred to under SAS as libname SPSS. Any of these
names can be changed, except for the engine type XPORT. Note that the
library is associated with a DOS file, rather than a DOS directory.
- If you need user-defined formats to be copied with the data,
associate a different libname with the XPORT engine, and copy your
formats catalog to a scratch dataset (called, say, FORMTS) in the WORK
directory, e.g.,
LIBNAME FORMT XPORT 'C:\SPSS\SASFORMT.DAT';
PROC FORMATS LIBRARY=LIBRARY CNTLOUT=FORMTS;
- Use PROC COPY to put the relevant data into the empty file, e.g.,
PROC COPY IN=DATA OUT=SPSS; SELECT MYDSET;
which puts dataset DATA.MYDSET into the export file. If you made a
format file in step 2, then also execute the command:
PROC COPY IN=WORK OUT=FORMT; SELECT FORMTS;
- Under SPSS, execute the command:
GET SAS DATA='C:\SPSS\SASXPRT1.DAT' DSET(MYDSET)
/FORMATS='C:\SPSS\SASFORMT.DAT' FSET(FORMTS).
assuming the file name and location to be as specified in step 1; omit
the /FORMATS switch if you didn't do the stuff in step 2.
Jay Weedon.