Date: Wed, 6 Dec 2000 09:59:57 -0600
Reply-To: Carol Albright <syzygy@TC.UMN.EDU>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Carol Albright <syzygy@TC.UMN.EDU>
Subject: Re: SAS code to SPSS question
In-Reply-To: <019f01c05f19$e51629f0$411ffcd1@lomax>
Content-Type: text/enriched; charset="us-ascii"
Hi, Kevin
Actually, the SF-36 is available in an SPSS flavor already (I think from
the developer of the scale). Do you have a copy of the documentation
that explains how the Bodily Pain scale is coded (ie the How to Score the
SF-36 Health Survey from The Medical Outcomes Trust in Boston is very
readable). (If you don't, e-mail me directly and I'll try to get you the
address. There's also a sample SPSS data set with know results you can
use to test your program).
SAS uses a semi-colon for a command terminator (SPSS uses periods).
This first line just says if PGLOB (v22) is missing then the new variable
(rv22 in my example, PGLOBR here) is also missing. This statement is
unnecessary in SPSS:
IF PGLOB=. THEN PGLOBR=.; (Drop this command)
To change alll the ELSE IF ... THEN's, delete the ELSE and THEN, change
the ; to a . :
ELSE IF PGLOB=1 THEN PGLOBR=6; in SAS becomes
IF PGLOB = 1 PGLOBR = 6. in SPSS. HOWEVER, you can also just do a
simple RECODE into a different variable (see second RECODE statement in
example below).
Here's code I know works (I tested it against a test data set with
published results, ie mean, valid range & N's etc) (v22 = question 22,
"How much bodily pain past 4 weeks", V23 = question 23, "How much did
pain interfere with work"), but before using it, make sure it handles
missing data the way you want it to:
<fontfamily><param>Courier
New</param>***************************************************************
**SF-36 Bodily Pain Subscale**.
* ITEM RECODING DEPENDS ON WHETHER BOTH v22 and v23
* ARE ANSWERED OR WHETHER ONE OF THE ITEMS HAS MISSING DATA.
*
* THIS SCALE IS POSITIVELY SCORED -- THE HIGHER THE SCORE
* THE LESS PAIN OR THE MORE FREEDOM FROM PAIN.
***************************************************************.
* This causes out-of-range values to be changed to system missing.
recode v22 v23 (1=1) (2=2) (3=3) (4=4) (5=5) (6=6) (else=sysmis).
RECODE v22 (1=6.0) (2=5.4) (3=4.2) (4=3.1) (5=2.2) (6=1.0) INTO rv22.
IF (v23=1 AND v22=1) rv23=6.0.
IF (v23=1 AND (v22>1 AND v22<<=6)) rv23=5.0.
IF (v23=2 AND (v22>=1 AND v22<<=6)) rv23=4.0.
IF (v23=3 AND (v22>=1 AND v22<<=6)) rv23=3.0.
IF (v23=4 AND (v22>=1 AND v22<<=6)) rv23=2.0.
IF (v23=5 AND (v22>=1 AND v22<<=6)) rv23=1.0.
IF (v23=1 AND MISSING(v22)) rv23=6.0.
IF (v23=2 AND MISSING(v22)) rv23=4.75.
IF (v23=3 AND MISSING(v22)) rv23=3.5.
IF (v23=4 AND MISSING(v22)) rv23=2.25.
IF (v23=5 AND MISSING(v22)) rv23=1.0.
IF (NOT MISSING(v22) AND NOT MISSING(v23)) sf36rbp=rv22 + rv23.
IF ((MISSING(sf36rbp)) AND (MISSING(v22))) sf36rbp=2*rv23.
IF ((MISSING(sf36rbp)) AND (MISSING(v23))) sf36rbp=2*rv22.
COMPUTE sf36BP=100*(sf36rbp-2)/10.
variable labels sf36BP "SF36 Bodily Pain Subscale".
</fontfamily>
HTH,
Carol
At 07:17 PM 12/5/00 -0500, KEVIN LOMAX wrote:
>I am having trouble recoding this SAS code for SPSS use. I am most
confused
>abuot the IF ELSE commands. I always have syntax errors because of
the
>unclosed
>END IF statements and such. Would you mind giving it a look. The 2
sets of
>IF ELSE code are the main concern.
>
>Thanks
>Kevin Lomax
>
>/********************************************************************/
>/* SCORE SF-36 PAIN SCALE (K=2) */
>/********************************************************************/
>/********************************************************************/
>/* REVERSE SCORE AND RECALIBRATE PGLOB (THE LATTER FOR EQUAL */
>/* INTERVAL PROPERTIES) */
>/********************************************************************/
>
>IF PGLOB=. THEN PGLOBR=.;
>ELSE IF PGLOB=1 THEN PGLOBR=6;
>ELSE IF PGLOB=2 THEN PGLOBR=5.4;
>ELSE IF PGLOB=3 THEN PGLOBR=4.2;
>ELSE IF PGLOB=4 THEN PGLOBR=3.1;
>ELSE IF PGLOB=5 THEN PGLOBR=2.2;
>ELSE IF PGLOB=6 THEN PGLOBR=1;
>RPGLOB=7-PGLOB;
>
>/********************************************************************/
>/* REVERSE SCORE PBEH4 */
>/********************************************************************/
>
>RPBEH4=6-PBEH4;
>IF PGLOBR=6 AND RPBEH4=5 THEN RPBEH4=6;
>IF PGLOBR=. AND RPBEH4 NE . THEN DO;
>IF RPBEH4=1 THEN PGLOBS=1; ELSE
>IF RPBEH4=2 THEN PGLOBS=2.25; ELSE
>IF RPBEH4=3 THEN PGLOBS=3.50; ELSE
>IF RPBEH4=4 THEN PGLOBS=4.75; ELSE
>IF RPBEH4=5 THEN PGLOBS=6.0; ELSE
>END;
>
>NPAIN=NMISS(PGLOBR,RPBEH4);
>IF NPAIN=2 THEN DO;
>RPAIN=.;
>END;
>
>IF NPAIN=1 AND RPBEH4=. THEN DO;
>RPBEH4=PGLOBR;
>END;
>
>IF NPAIN=1 AND PGLOBR=. THEN DO;
>PGLOBR=PGLOBS;
>END;
>
>RPAIN=MEAN(PGLOBR,RPBEH4);
>MIN=1; MAX=6;
>PAIN=(RPAIN-MIN)*100/(MAX-MIN);
>LABEL PAIN='PAIN';
>Kevin C. Lomax
>101 Sanders-Brown Center on Aging
>Lexington, KY 40536-0230
>Phone: 859-253-0057
>Fax: 859-323-2866
>
>
-------------------------------------------------------------------------
Carol L. Albright, MS | E-Mail : syzygy@tc.umn.edu
Albright Consulting | Phone : 651/699-7218
2031 Goodrich Avenue | http://www.tc.umn.edu/~syzygy
St. Paul, MN 55105 USA | Research data services
-------------------------------------------------------------------------