Desktop productivity for business analysts and programmers

SPSS Conversion

Reply
Occasional Contributor
Posts: 5

SPSS Conversion

Does anyone have any insight into SPSS .por file conversion in EG? I am able to import the file but I only am able to get the values but not the data dictionary which shows what the values are actually relating to. Any suggetions would be of help.
SAS Super FREQ
Posts: 8,720

Re: SPSS Conversion

I do not believe that there is an automated way to have SAS convert the SPSS data dictionary into a SAS format library. SAS formats are stored in a separate location. So, for example, if you do this:

[pre]
proc format fmtlib;
value agefmt low-12 = 'preteen'
13-17 = 'teenager'
other='young adult';
run;

proc freq data=sashelp.class;
title 'Using AGEFMT. Format';
tables age;
format age agefmt.;
run;
[/pre]
You will see that, for this run of PROC FREQ, the AGE variable values have been "recoded". But, the format values are not stored with the data. I could make a different format that has different values:
[pre]
proc format fmtlib;
value othrage low-12 = 'can talk to'
13-14 = 'might be able to talk to'
15-16='canNOT talk to'
other='can reason with';
run;

proc freq data=sashelp.class;
title 'Using OTHRAGE. Format';
tables age;
format age othrage.;
run;[/pre]

And then this new PROC FREQ will use the second format for its tables.

Perhaps someone who's used EG and SPSS can help you figure out how to accomplish what you need to do or you could contact Tech Support for further help constructing the formats you need.

cynthia

Output using first format:
[pre]
Using AGEFMT. Format

The FREQ Procedure

Cumulative Cumulative
Age Frequency Percent Frequency Percent
-----------------------------------------------------------------
preteen 7 36.84 7 36.84
teenager 12 63.16 19 100.00
[/pre]

Output using second format:
[pre]
Using OTHRAGE. Format

The FREQ Procedure

Cumulative Cumulative
Age Frequency Percent Frequency Percent
------------------------------------------------------------------------------
can talk to 7 36.84 7 36.84
might be able to talk to 7 36.84 14 73.68
canNOT talk to 5 26.32 19 100.00
[/pre]
N/A
Posts: 0

Re: SPSS Conversion

An SPSS file with *.por extension is a portable file that I was created using SPSS . . . it can be read into SAS using the SPSS engine as follows:

libname yourlib SPSS 'C:\xxxx\xxxx\myspssfile.por';

data mysasdata;
set yourlib._first_;
run;

Let me know how it turns out.

Hope this helps.
Occasional Contributor
Posts: 5

Re: SPSS Conversion

I can get all of that to work. Only problem with the import is that I get the data but nothing to reference it with, i.e. say a country has 4 variables, US, GB, Germany, and France. Each one has a value, US - 1, GB - 2, etc... I only am able to import the numbers without knowing what they represent. Make sense?
SAS Super FREQ
Posts: 8,720

Re: SPSS Conversion

Hi!
This SUGI paper compares common SPSS terms to SAS terms.
http://www2.sas.com/proceedings/sugi29/142-29.pdf

The value label question seems to be a common question/problem at universities, because many other sites have a link to this University site:
http://www.psych.yorku.ca/lab/sas/spss2sas.htm

Here's a quote about what it says regarding SPSS Value Labels & SAS Formats:

Converting SPSS Value Labels into SAS User-Defined Formats
There is no method provided by either SAS or SPSS to convert SPSS Value Labels into SAS Formats. Many difficult issues are involved, but the problems mostly stem from the following basic difference:
SPSS Value Labels are stored along with the data in the SPSS Active File (or, in permanent form, in the SPSS Save File)

SAS labels for individual values are called Formats, and are stored in a Format Library which is a SAS Catalog separate from the SAS data set.


Further in the article on the above site that they have a program for students to use to convert SPSS value labels into SAS formats, but when you click on the link to download the program, you get a "page not found". Since the web site is undated, it's hard to tell what version of SAS and/or SPSS they were talking about.

I did find mention in the SAS Tech Support FAQ about PROC CONVERT - -however, it did NOT say anything about whether it converted SPSS value labels:
http://support.sas.com/techsup/faq/base/convproc.html
http://support.sas.com/ctx/samples/index.jsp?sid=622&tab=details
http://support.sas.com/techsup/unotes/SN/015/015684.html
http://support.sas.com/techsup/unotes/SN/018/018263.html
http://support.sas.com/faq/003/FAQ00305.html
http://support.sas.com/faq/003/FAQ00304.html
http://support.sas.com/faq/003/FAQ00302.html

Perhaps your best bet for help with this question is to contact Tech Support.

cynthia
Super Contributor
Posts: 273

Re: SPSS Conversion

Charlie,
Your question is also sas basics.
If you have the original spss.sav file then you may try under sas v9.1.3 sp3 or more a
proc import datafile="d:\...\spss.sav" dbms=sav out=sastable; run;

I think, you find in the Sas work directory sastable.sas7bdat
with (often reworked) formatnames inside and a format.sas7bcat.
Be carefull: in case of many conversions the formats are added to the sas7bcat file
so you need to change the format file name to obtain individual table related catalog files.

try to submit this enriched proc import code from EG
Andre
Occasional Contributor
Posts: 5

Re: SPSS Conversion

Andre - I'll give that a shot. I appreciate the help!
Ask a Question
Discussion stats
  • 6 replies
  • 435 views
  • 0 likes
  • 4 in conversation