Desktop productivity for business analysts and programmers

SPSS program to SAS program conversion

Posts: 0

SPSS program to SAS program conversion

Does anyone have any insight about conversion of an SPSS program ".sps" to sas program ".sas". is-it feasible? I heard that there is a sas macro to do that...???????

the program is like that:

TITLE "A very simple program".
set width 80.
file handle in /name="/p/us/sue/zspssx/famous.dat".
idnum 1-3 (N)
fname 4-15 (A)
lname 16-27 (A)
age 28-29
sex 30
byear 31-34
dyear 35-38
status 39.
idnum "Case Number"
fname "First Name"
lname "Last Name"
age "Age at Death"
sex "Sex"
byear "Year of Birth"
dyear "Year of Death"
status "Status".
1 "Male"
2 "Female" /
1 "Real"
2 "Fictional"
3 "Possibly Real".
missing values
status (3).
select if (sex eq 2).
freq vars=status.
save outfile="famous_females.sav".

Thank you very match,
Trusted Advisor
Posts: 2,114

Re: SPSS program to SAS program conversion


There are tools for data conversion, but I am unaware of tools for code conversion. StatTransfer and DBMSCopy come to mind for data conversion. Also SAS 9.2 will, I believe, read SPSS datasets.

For code conversion, it's pretty straightforward. This is mostly the equivalent of a DATA step. One thing to note is that SPSS stores the value labels in with the data and SAS stores them separately, so they will need to be pulled out into a PROC FORMAT and then linked when needed.

Doc Muhlbaier
Posts: 0

Re: SPSS program to SAS program conversion

Thank you very much Doc. for confirming me this information! Because, I did some research before writing this message and I found a package SPSS2SAS for data conversion but there is no thing about code conversion.

Best wishes,

Posts: 0

Re: SPSS program to SAS program conversion

hello all

has there been an update regarding conversion of SPSS codes to SAS codes? Is that possible?
I am considering purchasing SAS given that SPSS code conversion to SAS is possible.

SAS Employee
Posts: 149

Re: SPSS program to SAS program conversion

I found a reference to a program called ESS which seems to do something like this (search for ESS in the pdf):

The paper referenced is here:

I didn't have time for a read of what the conversion involves, so apologies if it isn't on track for what you want.

Another resource that could be really valuable is the following, from the authors of the Little SAS Book. This is a paper about coming to SAS from SPSS:
Trusted Advisor
Posts: 2,114

Re: SPSS program to SAS program conversion

Actually ESS (EMACS Speaks Statistics) won't really convert SPSS code into SAS code. However, if you read in an SPSS code file in SAS mode, it will hilight the places that are likely to be in error in the SAS syntax. That will go a long way toward conversion. [It won't catch all the errors, but it will provide a good start.]
Super Contributor
Super Contributor
Posts: 3,174

Re: SPSS program to SAS program conversion

Realistically, given the sample code you shared, I cannot say that I would want an automatic SPSS-to-SAS code conversion, given the differences in the language.

Scott Barry
SBBWorks, Inc.
Ask a Question
Discussion stats
  • 6 replies
  • 4 in conversation