Date: Wed, 7 Sep 2005 15:55:18 -0600
Reply-To: William Dudley <william.dudley@nurs.utah.edu>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: William Dudley <william.dudley@nurs.utah.edu>
Subject: Re: SPSS to SAS version 9.1
Content-Type: text/plain; charset=US-ASCII
Mike and or Pat.
This discussion is helpful.
BUT what happens to me when I run the SPSS syntax, is that I get a SAS
files that I can examine in the viewer,
but when I run the SAS routine either copied from this note or opened
from the c drive If get the following in the log
99 proc datasets library = library ;
Directory
Libref
LIBRARY
Engine V9
Physical Name c:\
File Name c:\
Member File
# Name Type Size Last
Modified
1 ASSAS DATA 9216
07Sep05:15:43:51
2 FORMATS CATALOG 17408
07Sep05:15:45:56
100 modify asSas;
ERROR: Integer divide by zero.
ERROR: Termination due to Floating Point Exception
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE DATASETS used (Total process time):
real time 0.00 seconds
cpu time 0.01 seconds
101 format x x.;
102 quit;
Any ideas why this works for you guys and not me?
I am running SAS 9.1
By the way
If I use the .por approach I get
204 proc datasets library = work ;
Directory
Libref WORK
Engine V9
Physical Name
d:\sastemp\_TD3200
File Name
d:\sastemp\_TD3200
Member File
# Name Type Size Last
Modified
1 FORMATS CATALOG 17408
07Sep05:15:53:19
2 TEMP DATA 5120
07Sep05:15:53:19
205 modify temp;
WARNING: Variable X not found in data set WORK.TEMP.
206 format x x.;
207 quit;
NOTE: MODIFY was successful for WORK.TEMP.DATA.
NOTE: PROCEDURE DATASETS used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
thanks
Bill
**********************************************************************
William N. Dudley, PhD
Emma Eccles Jones Nursing Research Center
University of Utah
College of Nursing
10 South 2000 East
Salt Lake City, UT 84122-5880
http://www.nurs.utah.edu/faculty/william_dudley.htm
**********************************************************************
>>> michael healy <healym@earthlink.net> 9/7/2005 3:14:16 PM >>>
Hi Pat, I haven't seen that happening, any SAS experts out there?
Here's a code example using SPSS 13 and SAS 9.1. HTH, Mike
----Original Message-----
From: Patricia.Cleland@edu.gov.on.ca
Sent: Sep 7, 2005 2:23 PM
To: healym@earthlink.net
Subject: RE: SPSS to SAS version 9.1
Michael,
When you read in the .por file are the value labels truncated?
I've just exported a file to a colleague who works in SAS and when he
ran
PROC FREQ, the resulting tables had value labels that were only 8
characters
wide, for example, 'No Response' became 'No Respo'.
Pat
data list list /x.
begin data
1
2
3
end data.
compute newLongVariableName = x.
format x (f8.0).
var levels x (nominal).
var labels x 'This is the label for variable X; it''s a long one'.
val labels x 1 'THIS IS THE FIRST CATEGORY'
2 'THIS IS THE SECOND CATEGORY'
3 'THIS IS THE THIRD CATEGORY'.
exe.
EXPORT OUTFILE='c:\asPor.por'.
SAVE TRANSLATE OUTFILE='c:\asSas.sas7bdat'
/TYPE=SAS /VERSION=7 /PLATFORM=WINDOWS /MAP /REPLACE
/VALFILE='c:\asSas.sas' .
/* this is the command file produced by SPSS for .sas7bdat data files
*/
/* wouldn't you know, this actually works...so the POR routine is not
necessary in this example ;) */
libname library 'c:\' ;
proc format library = library ;
value x /* This is the label for variable X; it's a long one */
1 = 'THIS IS THE FIRST CATEGORY'
2 = 'THIS IS THE SECOND CATEGORY'
3 = 'THIS IS THE THIRD CATEGORY' ;
proc datasets library = library ;
modify asSas;
format x x.;
quit;
/* Here's a way to work with POR files when the sas7bdat route fails
*/
libname library2 SPSS 'c:\asPor.por' ;
data work.temp;
set library2._first_;
run;
/* no problems here with variable labels being truncated */
proc freq data = work.temp;
tables x newlongv;
run;
proc format library = work ;
value x /* This is the label for variable X; it's a long one */
1 = 'THIS IS THE FIRST CATEGORY'
2 = 'THIS IS THE SECOND CATEGORY'
3 = 'THIS IS THE THIRD CATEGORY' ;
proc datasets library = work ;
modify temp;
format x x.;
quit;
-
-----Original Message-----
From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf
Of
michael healy
Sent: September 7, 2005 1:20 PM
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: Re: SPSS to SAS version 9.1
My workaround for this problem is to export the SPSS file as a
.sas7bdat and
.por file. I then read in the .por file and apply the formatting
statements...I'm not sas whiz but it works...
let me know if you need code examples...
Mike
-----Original Message-----
From: William Dudley <william.dudley@nurs.utah.edu>
Sent: Sep 7, 2005 9:05 AM
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: SPSS to SAS version 9.1
I am trying to transport SPSS (version 13) data files to SAS (version
9.1).
I have used the SPSS "save as" option and selected SAS with long
extension.
This gives me the following syntax in SPSS
SAVE TRANSLATE OUTFILE='R:\test\mydata.sas7bdat'
/TYPE=SAS /VERSION=7 /PLATFORM=WINDOWS /MAP /REPLACE
/VALFILE='R:\test\mydata.sas' .
The data set appears to be valid when I open it in SAS using the
viewer, But
when I run the SAS syntax created by SPSS I get a: " divide by zero"
error
in my SAS run.
Program is below.
I think this is due to an error in the SAS program created by SPSS.
Does
anyone have a suggestion?
Thanks
Bill
Here is the SAS program
libname library 'r:\test\' ;
proc format library = library ;
value type /* Session Type */
1 = 'Prenatal'
2 = 'Cancer' ;
value FemaleNa /* Name of Client */
1 = 'Clara'
2 = 'Stephanie'
3 = 'Vanya'
4 = 'Ayodola'
5 = 'Ines'
6 = 'Jeanet' ;
value RaceR /* Client Race */
1 = 'Caucasian'
2 = 'African American'
3 = 'Hispanic' ;
value dyad /* Single or Dyad */
1 = 'No Spouse'
2 = 'Spouse Present' ;
value SpouseNa /* Name of Spouse */
0 = 'No Spouse'
1 = 'Dave'
2 = 'Michael'
3 = 'Romel' ;
value WeekDayA
1 = 'Friday'
2 = 'Saturday'
3 = 'Sunday'
4 = 'Monday'
5 = 'Tuesday'
6 = 'Local Baltimore'
7 = 'Local Philadelphia' ;
value GC_gende /* Genetic Counselor Gender */
1 = 'Male'
2 = 'Female' ;
value GC_Pre_A /* Genetic Counselor Age */
1 = '21-25'
2 = '26-30'
3 = '31-35'
4 = '36-40'
5 = '41-45'
6 = '46-50'
7 = '51-55'
8 = '56-60'
9 = '61-65'
10 = '66+' ;
value GC_Pre_E /* Genetic Counselor Ethnicity */
1 = 'Caucasian'
2 = 'African American'
3 = 'Hispanic'
4 = 'Asian'
5 = 'Native American'
6 = 'Eastern European/Jewish'
7 = 'Other' ;
value GC_Pre_G /* Genetic Counselor Years as Genetic Counselor */
1 = '0-2'
2 = '2-5'
3 = '5-10'
4 = '10-15'
5 = '15-20'
6 = '20-25'
7 = '25+' ;
value GC_Pre_P /* Genetic Counselor Years as Prenatal Counselor */
1 = '0-2'
2 = '2-5'
3 = '5-10'
4 = '10-15'
5 = '15-20'
6 = '20-25'
7 = '25+' ;
value GC_Pre_C /* Genetic Counselor Years as Cancer Counselor */
1 = '0-2'
2 = '2-5'
3 = '5-10'
4 = '10-15'
5 = '15-20'
6 = '20-25'
7 = '25+' ;
value GC_Pre_P
1 = 'None'
2 = 'Less than half'
3 = 'About half'
4 = 'More than half'
5 = 'All' ;
value GC_Pre_P
1 = 'None'
2 = 'Less than half'
3 = 'About half'
4 = 'More than half'
5 = 'All' ;
value GC_Pre_C
1 = 'None'
2 = 'Less than half'
3 = 'About half'
4 = 'More than half'
5 = 'All' ;
value GC_Pre_A
1 = 'None'
2 = 'Less than half'
3 = 'About half'
4 = 'More than half'
5 = 'All' ;
value GC_Pre_O
1 = 'None'
2 = 'Less than half'
3 = 'About half'
4 = 'More than half'
5 = 'All' ;
value GC_Pre_R
1 = 'None'
2 = 'Slight'
3 = 'Moderate'
4 = 'Extensive' ;
value GC_Pre_A
0 = 'No'
1 = 'Yes' ;
value GC_Pre_V
0 = 'No'
1 = 'Yes' ;
value GC_Pre_P
1 = 'Extremely comfortable'
2 = 'Somewhat comfortable'
3 = 'Somewhat uncomfortable'
4 = 'Extremely uncomfortable' ;
value GC_Pre_P
1 = 'Extremely helpful'
2 = 'Moderately helpful'
3 = 'Slightly helpful'
4 = 'Not at all helpful' ;
value GC_Post_ /* To what extent were you able to think of this
client as
real? */
1 = 'Not at all'
2 = 'Somewhat real'
3 = 'Moderately real'
4 = 'completely real' ;
value GC_Post_ /* If your clients husband was present, to what
extent
were you able to think of him as real? */
1 = 'Not at all'
2 = 'Somewhat real'
3 = 'Moderately real'
4 = 'Completely real'
5 = 'N/A' ;
value GC_Post_ /* To what extent had you discussed this case with
other
counselors before coming today? */
1 = 'Not at all'
2 = 'I had talked about some aspects'
3 = 'I had talked about many aspects' ;
value GC_Post_ /* Would you be willing to participate in a similar
study
in the future if asked? */
0 = 'No'
1 = 'Yes'
2 = 'Maybe' ;
value GC_Post_ /* Would you recommend that your friends/colleagues
participate in a study like this? */
0 = 'No'
1 = 'Yes'
2 = 'Maybe' ;
value SCW_Ques /* What degree of confidence would you say you have
in
this genetic counselor? */
1 = 'Very Much'
2 = 'Moderately'
3 = 'Somewhat'
4 = 'Slightly'
5 = 'None' ;
value SCW_Ques /* Would you come back to see this genetic counselor?
*/
1 = 'Definitely'
2 = 'Maybe'
3 = 'Reluctantly'
4 = 'Not at all' ;
value SCW_Ques /* Did you feel the genetic counselor was aware of
your
emotional state? */
1 = 'Very much'
2 = 'Moderately'
3 = 'Somewhat'
4 = 'Slight'
5 = 'None' ;
value SCW_Ques /* Did you feel the genetic counselor was interested
in
your emotional state? */
1 = 'Very much'
2 = 'Moderately'
3 = 'Somewhat'
4 = 'Slight'
5 = 'None' ;
value SCW_Ques /* To what extent did you feel comfortable disclosing
your
emotional state to this genetic counselor? */
1 = 'Very much'
2 = 'Moderately'
3 = 'Somewhat'
4 = 'Slight'
5 = 'None' ;
value SCW_Ques /* To what extend did you feel comfortable overall
with
this genetic counselor? */
1 = 'Very much'
2 = 'Moderately'
3 = 'Somewhat'
4 = 'Slight'
5 = 'None' ;
value SCW_Ques /* Did you feel the genetic counselor understood how
you
felt emotionally? */
1 = 'Very much'
2 = 'Moderately'
3 = 'Somewhat'
4 = 'Slight'
5 = 'None' ;
value SCW_Ques /* Did anything the genetic counselor do or say help
you
feel any better emotionally? */
0 = 'No'
1 = 'Yes' ;
value SCW_Ques /* Did anything the genetic counselor do or say help
you
feel any worse emotionally? */
0 = 'No'
1 = 'Yes' ;
value SCM_Ques /* What degree of confidence would you say you have
in
this genetic counselor? */
1 = 'Very Much'
2 = 'Moderately'
3 = 'Somewhat'
4 = 'Slightly'
5 = 'None' ;
value SCM_Ques /* Would you come back to see this genetic counselor?
*/
1 = 'Definitely'
2 = 'Maybe'
3 = 'Reluctantly'
4 = 'Not at all' ;
value SCM_Ques /* Did you feel the genetic counselor was aware of
your
emotional state? */
1 = 'Very much'
2 = 'Moderately'
3 = 'Somewhat'
4 = 'Slight'
5 = 'None' ;
value SCM_Ques /* Did you feel the genetic counselor was interested
in
your emotional state? */
1 = 'Very much'
2 = 'Moderately'
3 = 'Somewhat'
4 = 'Slight'
5 = 'None' ;
value SCM_Ques /* To what extent did you feel comfortable disclosing
your
emotional state to this genetic counselor? */
1 = 'Very much'
2 = 'Moderately'
3 = 'Somewhat'
4 = 'Slight'
5 = 'None' ;
value SCM_Ques /* To what extend did you feel comfortable overall
with
this genetic counselor? */
1 = 'Very much'
2 = 'Moderately'
3 = 'Somewhat'
4 = 'Slight'
5 = 'None' ;
value SCM_Ques /* Did you feel the genetic counselor understood how
you
felt emotionally? */
1 = 'Very much'
2 = 'Moderately'
3 = 'Somewhat'
4 = 'Slight'
5 = 'None' ;
value SCM_Ques /* Did anything the genetic counselor do or say help
you
feel any better emotionally? */
0 = 'No'
1 = 'Yes' ;
value SCM_Ques /* Did anything the genetic counselor do or say help
you
feel any worse emotionally? */
0 = 'No'
1 = 'Yes' ;
value GC_Regio /* Genetic Counselor NSGC Region */
1 = 'I'
2 = 'II'
3 = 'III'
4 = 'IV'
5 = 'V'
6 = 'VI' ;
proc datasets library = library ;
modify mydata;
format type type.;
format FemaleNameR FemaleNa.;
format RaceR RaceR.;
format dyad dyad.;
format SpouseNameR SpouseNa.;
format WeekDayR WeekDayA.;
format GC_gender GC_gende.;
format GC_Pre_AgeR GC_Pre_A.;
format GC_Pre_EthnicityR GC_Pre_E.;
format GC_Pre_GCYrsR GC_Pre_G.;
format GC_Pre_PrenatalYrsR GC_Pre_P.;
format GC_Pre_CancerYrsR GC_Pre_C.;
format GC_Pre_PrenatalPortionR GC_Pre_P.;
format GC_Pre_PediatricPortionR GC_Pre_P.;
format GC_Pre_CancerPortionR GC_Pre_C.;
format GC_Pre_AdultPortionR GC_Pre_A.;
format GC_Pre_OtherPortionR GC_Pre_O.;
format GC_Pre_RolePlayExpR GC_Pre_R.;
format GC_Pre_ActorExpR GC_Pre_A.;
format GC_Pre_VideoExpR GC_Pre_V.;
format GC_Pre_PastComfR GC_Pre_P.;
format GC_Pre_PastHelpR GC_Pre_P.;
format GC_Post_Question29R GC_Post_.;
format GC_Post_Question30R GC_Post_.;
format GC_Post_Question31R GC_Post_.;
format GC_Post_Question33R GC_Post_.;
format GC_Post_Question34R GC_Post_.;
format SCW_Question2R SCW_Ques.;
format SCW_Question3R SCW_Ques.;
format SCW_Question19R SCW_Ques.;
format SCW_Question20R SCW_Ques.;
format SCW_Question21R SCW_Ques.;
format SCW_Question22R SCW_Ques.;
format SCW_Question23R SCW_Ques.;
format SCW_Question24aR SCW_Ques.;
format SCW_Question25aR SCW_Ques.;
format SCM_Question2R SCM_Ques.;
format SCM_Question3R SCM_Ques.;
format SCM_Question19R SCM_Ques.;
format SCM_Question20R SCM_Ques.;
format SCM_Question21R SCM_Ques.;
format SCM_Question22R SCM_Ques.;
format SCM_Question23R SCM_Ques.;
format SCM_Question24aR SCM_Ques.;
format SCM_Question25aR SCM_Ques.;
format GC_Region GC_Regio.;
quit;
**********************************************************************
William N. Dudley, PhD
Emma Eccles Jones Nursing Research Center
University of Utah
College of Nursing
10 South 2000 East
Salt Lake City, UT 84122-5880
http://www.nurs.utah.edu/faculty/william_dudley.htm
**********************************************************************