BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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".
DATA LIST FILE=in /
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.
VAR LABELS
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".
VALUE LABELS
sex
1 "Male"
2 "Female" /
status
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,
6 REPLIES 6
Doc_Duke
Rhodochrosite | Level 12
Lyn,

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
Duke
deleted_user
Not applicable
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,

LynE
deleted_user
Not applicable
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.

Regards
Pablo
RichardH_sas
SAS Employee
I found a reference to a program called ESS which seems to do something like this (search for ESS in the pdf):
http://www2.sas.com/proceedings/sugi29/142-29.pdf

The paper referenced is here:
http://www.bepress.com/cgi/viewcontent.cgi?article=1002&context=uwbiostat

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:
http://support.sas.com/publishing/bbu/companion_site/62272.pdf
Doc_Duke
Rhodochrosite | Level 12
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.]
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 3098 views
  • 0 likes
  • 4 in conversation