Converting a SAS system file on Unix to a SPSS system file for the PC

A. If there is no format to convert:

Step 1: Make a SAS portable data file on the Unix machine.

*Assume ‘child2.ssd01’ is the SAS system file and ‘child2.ptb’ is the portable data file;

libname libin '/usr/work/baxinn/Nepal/sasdata';
libname libout xport '/usr/shared/cathys/child2.ptb';

proc copy in=libin out=libout;
select child2;
run;

Step 2: Read the portable data file to PC SPSS and make a SPSS system file

COMMENT Assume the SPSS system file is ‘child2.sav’

get sas data='t:\cathys\child2.ptb'.

file handle out / name='t:\cathys\child2.sav'.
save outfile=out.
execute .

B. If the format is also converted:

Step 1: Make both data and format portable file on the Unix machine.

* Assume ‘child2.ssd01’ is the SAS system file and ‘child2.ptb’ is the portable data file;
* and ‘fmts.ptb’ is the format catalog;

libname libin '/usr/work/baxinn/Nepal/sasdata';
libname libout1 xport '/usr/shared/cathys/child2.ptb';
libname libout2 xport '/usr/shared/cathys/fmts.ptb';

*Convert the data;

proc copy in=libin out=libout1;
select child2;
run;

*Convert the formats catalog;

proc format library=libin cntlout=fmts;
run;

proc copy in=work out=libout2;
select fmts;
run;
Step 2: Read both the portable data and format files to PC SPSS and make a SPSS system file

COMMENT Assume the SPSS system file is ‘child2.sav’

get sas data='t:\cathys\child2.ptb' /formats=’t:\cathys\fmts.ptb’.

file handle out / name='t:\cathys\child2.sav'.
save outfile=out.
Execute .

NEW PSC blog

Recent resources, events, news

New Publications

Knodel et al. "Gendered Housework in Vietnam." PSC Research Report.

Couper. Designing Effective Web Surveys

Next Brown Bag

Monday, Oct 13
Jamie Jones
"Fertility & Risk Aversion on Utah Frontier"


W A R N I N G

If you are reading this, it may be that you are using rather old web browsing software that does not support modern international Web technology standards. For a better experience of the Web and this site in particular, please upgrade your web browser software today. The following are good choices: Firefox 2; Opera 9; Safari 3.