SPSS syntax for comorbidity

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

SPSS syntax for comorbidity

Suh-Ing Amy Hsieh
Hi list users:
I am working on the dataset for my dissertation using the HCUP comorbidity
algorithm. I use 30 conditions for creating comorbidity using string
ICD9CM_code to ICD9CM_code_4. The first part of syntax works but the second
part of syntax does not work for me. Any suggestions are highly thanked.
Amy

**ICD9CM algorithm using HCUP 3.3 version of Elixhauser comorbidity (2008)**
**Set new variable to count=0 (rather than missing)**
COMPUTE chf=0.
COMPUTE valve=0.
COMPUTE pulmcirc=0.
COMPUTE perivasc=0.
COMPUTE htn=0.
COMPUTE htncx=0.
COMPUTE htnpreg=0.
COMPUTE htnwochf =0.
COMPUTE htnwhf=0.
COMPUTE hrenworf=0.
COMPUTE hrenwrf=0.
COMPUTE hhrwohrf=0.
COMPUTE hhrwchf=0.
COMPUTE hhrwrf=0.
COMPUTE hhrwhrf=0.
COMPUTE ohtnpreg=0.
COMPUTE para=0.
COMPUTE neuro=0.
COMPUTE chrnlung=0.
COMPUTE dm=0.
COMPUTE dmcx=0.
COMPUTE hypothy=0.
COMPUTE renlfail=0.
COMPUTE liver=0.
COMPUTE ulcer=0.
COMPUTE aids=0.
COMPUTE lymph=0.
COMPUTE mets=0.
COMPUTE tumor=0.
COMPUTE arth=0.
COMPUTE coag=0.
COMPUTE obese=0.
COMPUTE wghtloss=0.
COMPUTE lytes=0.
COMPUTE bldloss=0.
COMPUTE anemdef=0.
COMPUTE alcohol=0.
COMPUTE drug=0.
COMPUTE psych=0.
COMPUTE depress=0.
COMPUTE CCI=0.
EXECUTE.

**Create flag variables for each ICD9CM_code**
DO REPEAT dx=ICD9CM_code  TO ICD9CM_code_4.
VECTOR dx=ICD9CM_code TO ICD9CM_code_4.
LOOP #d = 1 TO 5.
+  IF (dx='39891' '4280' '4281' '4289') chf = 1.
+  IF (dx='09320' '09321' '09322' '09323' '09324'  '3940'
       '3941' '3942' '3949' '3950' '3951' '3952' '3959'
       '3960' '3961' '3962' '3963' '3968' '3969' '3970'
       '3971' '3979' '4240' '4241' '4242' '4243' '42490'
       '42491' '42499' '7463' '7464' '7465' '7466' 'V422'
       'V433') valve=1.
+  IF (dx='41511' '41519' '4160' '4161' '4168' '4169' '4179') pulmcirc=1.
END IF.
END REPEAT.
END LOOP.
EXECUTE.

**Create one variable reflecting comorbidity**.
if chf=1 CCI=1.
if valve=1 CCI=1.
if pulmcirc=1 CCI=1.
if perivasc=1 CCI=1.
if htn=1 CCI=1.
if htncx=1 CCI=1.
if phtpreg=1 CCI=1.
if htnwochf=1 CCI=1.
if htnwhf=1 CCI=1.
if hrenworf=1 CCI=1.
if hrenwrf=1 CCI=1.
if hhrwohrf=1 CCI=1.
if hhrwchf=1 CCI=1.
if hhrwrf=1 CCI=1.
if hhrwhrf=1 CCI=1.
if ohtnpreg=1 CCI=1.
if para=1 CCI=1.
if neuro=1 CCO=1.
if chrnlung=1 CCI=1.
if dm=1 CCI=1.
if dmcx=1 CCI=1.
if hypothy=1 CCI=1.
if renlfail=1 CCI=1.
if liver=1 CCI=1.
if ulcer=1 CCI=1.
if aids=1 CCI=1.
if lymph=1 CCI=0.
if mets=1 CCI=0.
if tumor=1 CCI=0.
if arth=1 CCI=1.
if coag=1 CCI=1.
if obese=1 CCI=1.
if wghtloss=1 CCI=1.
if lytes=1 CCI=1.
if bldloss=1 CCI=1.
if anemdef=1 CCI=1.
if alcohol=1 CCI=1.
if drug=1 CCI=1.
if psych=1 CCI=1.
if depress=1 CCI=1.

**Initialize hypertension, CHF, and renal comorbidity flags to 1 using the
detail hypertension flags**
if htnpreg=1 THEN htncx=1.
if htnwochf=1 THEN htncx=1.
if htnchf=1 THEN DO.
Htncx=1.
Chf=1.
END.

If hrenworf=1 THEN htncx=1.
If hrenwrf=1 THEN DO.
Htncx=1.
Renlfail=1.
END.

If hhrwohrf=1 THEN htncx=1.
If hhrwchf=1 THEN DO.
Htncx=1.
Chf=1.
END.

If hhrwrf=1 THEN DO.
Htncx=1.
Renlfail=1.
END.

If hhrwhrf=1 THEN DO.
Htncx=1.
Chf=1
Renlfail=1.
END.

If ohtnpreg=1 THEN htncx=1.

**set up code to only count the more severe comorbidity**
if htncx=1 THEN htn=0.
if mets=1 THEN tumor=0.
if dmcx=1 THEN dm=0.

COMPUTE MEANSUB=MEAN(ICD9CM_code TO ICD9CM_code_4).
FREQUENCIES
 VARIABLES=CCI
 /ORDER=  ANALYSIS .

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: SPSS syntax for comorbidity

ViAnn Beadle
You have to be more specific about what doesn't work for you. In what way
doesn't it work?

Also, you appear to be missing command terminator for your comment on "Set
new variable to count..." which means that first compute chf=0 is read as
part of the comment.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Suh-Ing Amy Hsieh
Sent: Tuesday, April 22, 2008 9:01 AM
To: [hidden email]
Subject: SPSS syntax for comorbidity

Hi list users:
I am working on the dataset for my dissertation using the HCUP comorbidity
algorithm. I use 30 conditions for creating comorbidity using string
ICD9CM_code to ICD9CM_code_4. The first part of syntax works but the second
part of syntax does not work for me. Any suggestions are highly thanked.
Amy

**ICD9CM algorithm using HCUP 3.3 version of Elixhauser comorbidity (2008)**
**Set new variable to count=0 (rather than missing)**
COMPUTE chf=0.
COMPUTE valve=0.
COMPUTE pulmcirc=0.
COMPUTE perivasc=0.
COMPUTE htn=0.
COMPUTE htncx=0.
COMPUTE htnpreg=0.
COMPUTE htnwochf =0.
COMPUTE htnwhf=0.
COMPUTE hrenworf=0.
COMPUTE hrenwrf=0.
COMPUTE hhrwohrf=0.
COMPUTE hhrwchf=0.
COMPUTE hhrwrf=0.
COMPUTE hhrwhrf=0.
COMPUTE ohtnpreg=0.
COMPUTE para=0.
COMPUTE neuro=0.
COMPUTE chrnlung=0.
COMPUTE dm=0.
COMPUTE dmcx=0.
COMPUTE hypothy=0.
COMPUTE renlfail=0.
COMPUTE liver=0.
COMPUTE ulcer=0.
COMPUTE aids=0.
COMPUTE lymph=0.
COMPUTE mets=0.
COMPUTE tumor=0.
COMPUTE arth=0.
COMPUTE coag=0.
COMPUTE obese=0.
COMPUTE wghtloss=0.
COMPUTE lytes=0.
COMPUTE bldloss=0.
COMPUTE anemdef=0.
COMPUTE alcohol=0.
COMPUTE drug=0.
COMPUTE psych=0.
COMPUTE depress=0.
COMPUTE CCI=0.
EXECUTE.

**Create flag variables for each ICD9CM_code**
DO REPEAT dx=ICD9CM_code  TO ICD9CM_code_4.
VECTOR dx=ICD9CM_code TO ICD9CM_code_4.
LOOP #d = 1 TO 5.
+  IF (dx='39891' '4280' '4281' '4289') chf = 1.
+  IF (dx='09320' '09321' '09322' '09323' '09324'  '3940'
       '3941' '3942' '3949' '3950' '3951' '3952' '3959'
       '3960' '3961' '3962' '3963' '3968' '3969' '3970'
       '3971' '3979' '4240' '4241' '4242' '4243' '42490'
       '42491' '42499' '7463' '7464' '7465' '7466' 'V422'
       'V433') valve=1.
+  IF (dx='41511' '41519' '4160' '4161' '4168' '4169' '4179') pulmcirc=1.
END IF.
END REPEAT.
END LOOP.
EXECUTE.

**Create one variable reflecting comorbidity**.
if chf=1 CCI=1.
if valve=1 CCI=1.
if pulmcirc=1 CCI=1.
if perivasc=1 CCI=1.
if htn=1 CCI=1.
if htncx=1 CCI=1.
if phtpreg=1 CCI=1.
if htnwochf=1 CCI=1.
if htnwhf=1 CCI=1.
if hrenworf=1 CCI=1.
if hrenwrf=1 CCI=1.
if hhrwohrf=1 CCI=1.
if hhrwchf=1 CCI=1.
if hhrwrf=1 CCI=1.
if hhrwhrf=1 CCI=1.
if ohtnpreg=1 CCI=1.
if para=1 CCI=1.
if neuro=1 CCO=1.
if chrnlung=1 CCI=1.
if dm=1 CCI=1.
if dmcx=1 CCI=1.
if hypothy=1 CCI=1.
if renlfail=1 CCI=1.
if liver=1 CCI=1.
if ulcer=1 CCI=1.
if aids=1 CCI=1.
if lymph=1 CCI=0.
if mets=1 CCI=0.
if tumor=1 CCI=0.
if arth=1 CCI=1.
if coag=1 CCI=1.
if obese=1 CCI=1.
if wghtloss=1 CCI=1.
if lytes=1 CCI=1.
if bldloss=1 CCI=1.
if anemdef=1 CCI=1.
if alcohol=1 CCI=1.
if drug=1 CCI=1.
if psych=1 CCI=1.
if depress=1 CCI=1.

**Initialize hypertension, CHF, and renal comorbidity flags to 1 using the
detail hypertension flags**
if htnpreg=1 THEN htncx=1.
if htnwochf=1 THEN htncx=1.
if htnchf=1 THEN DO.
Htncx=1.
Chf=1.
END.

If hrenworf=1 THEN htncx=1.
If hrenwrf=1 THEN DO.
Htncx=1.
Renlfail=1.
END.

If hhrwohrf=1 THEN htncx=1.
If hhrwchf=1 THEN DO.
Htncx=1.
Chf=1.
END.

If hhrwrf=1 THEN DO.
Htncx=1.
Renlfail=1.
END.

If hhrwhrf=1 THEN DO.
Htncx=1.
Chf=1
Renlfail=1.
END.

If ohtnpreg=1 THEN htncx=1.

**set up code to only count the more severe comorbidity**
if htncx=1 THEN htn=0.
if mets=1 THEN tumor=0.
if dmcx=1 THEN dm=0.

COMPUTE MEANSUB=MEAN(ICD9CM_code TO ICD9CM_code_4).
FREQUENCIES
 VARIABLES=CCI
 /ORDER=  ANALYSIS .

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: SPSS syntax for comorbidity

Maguin, Eugene
In reply to this post by Suh-Ing Amy Hsieh
I asked Amy for clarification off list and she replied with a section of
output, of which I include the relevant part below.

DO REPEAT dx=ICD9CM_code  TO ICD9CM_code_4.
VECTOR dx=ICD9CM_code TO ICD9CM_code_4.
LOOP #d = 1 TO 5.
+  IF (dx='39891'  '4280'  '4281'  '4289') chf = 1.
+  IF (dx='09320'  '09321'  '09322'  '09323'  '09324'  '3940'
         '3941'  '3942'  '3949'  '3950'  '3951'  '3952'  '3959'
         '3960'  '3961'  '3962'  '3963'  '3968'  '3969'  '3970'
         '3971'  '3979'  '4240'  '4241'  '4242'  '4243'  '42490'
         '42491'  '42499' '7463'  '7464'  '7465'  '7466'  'V422'
         'V433') valve=1.
+  IF (dx='41511'  '41519'  '4160'  '4161'  '4168'  '4169'  '4179')
pulmcirc=1.
END IF.
END REPEAT.

>Error # 4010 in column 20.  Text: 4280
>The expression contained two operands not separated by an operator.  Check
>the expression for omitted or extra operands, operators, and parentheses.
>This command not executed.


>Error # 4010 in column 20.  Text: 09321
>The expression contained two operands not separated by an operator.  Check
>the expression for omitted or extra operands, operators, and parentheses.
>This command not executed.

My reply.

Amy, You have if statement syntax problems. Go from

+  IF (dx='39891'  '4280'  '4281'  '4289') chf = 1.

To

+  IF (dx='39891' or dx='4280' or dx='4281' or dx='4289') chf = 1.

For all if statements.

Gene Maguin

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: SPSS syntax for comorbidity

ViAnn Beadle
The ANY function might be easier to use here.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Gene Maguin
Sent: Tuesday, April 22, 2008 12:53 PM
To: [hidden email]
Subject: Re: SPSS syntax for comorbidity

I asked Amy for clarification off list and she replied with a section of
output, of which I include the relevant part below.

DO REPEAT dx=ICD9CM_code  TO ICD9CM_code_4.
VECTOR dx=ICD9CM_code TO ICD9CM_code_4.
LOOP #d = 1 TO 5.
+  IF (dx='39891'  '4280'  '4281'  '4289') chf = 1.
+  IF (dx='09320'  '09321'  '09322'  '09323'  '09324'  '3940'
         '3941'  '3942'  '3949'  '3950'  '3951'  '3952'  '3959'
         '3960'  '3961'  '3962'  '3963'  '3968'  '3969'  '3970'
         '3971'  '3979'  '4240'  '4241'  '4242'  '4243'  '42490'
         '42491'  '42499' '7463'  '7464'  '7465'  '7466'  'V422'
         'V433') valve=1.
+  IF (dx='41511'  '41519'  '4160'  '4161'  '4168'  '4169'  '4179')
pulmcirc=1.
END IF.
END REPEAT.

>Error # 4010 in column 20.  Text: 4280
>The expression contained two operands not separated by an operator.  Check
>the expression for omitted or extra operands, operators, and parentheses.
>This command not executed.


>Error # 4010 in column 20.  Text: 09321
>The expression contained two operands not separated by an operator.  Check
>the expression for omitted or extra operands, operators, and parentheses.
>This command not executed.

My reply.

Amy, You have if statement syntax problems. Go from

+  IF (dx='39891'  '4280'  '4281'  '4289') chf = 1.

To

+  IF (dx='39891' or dx='4280' or dx='4281' or dx='4289') chf = 1.

For all if statements.

Gene Maguin

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: SPSS syntax for comorbidity

hillel vardi
In reply to this post by Suh-Ing Amy Hsieh
Shalom

The use of loop inside the do repeat is redundant  you don't need it ,
you only have 5 variables so you only need one loop ether do repeat or
loop .
If you use vector you have to use subscript

The  way to do what you want is

DO REPEAT dx=ICD9CM_code  TO ICD9CM_code_4.
+  IF any(dx,'39891', '4280', '4281', '4289') chf = 1.
+  IF any(dx,'41511', '41519', '4160', '4161' ,'4168' ,'4169', '4179') pulmcirc=1.
end repeat .

The code

if htnchf=1 THEN DO.
Htncx=1.
Chf=1.
END.

Is OK in SAS but in SPSS you have to use compute to assign values , and you don't have the do .. end  code .

Instead use

do if htnchf=1 .
compute  Htncx=1.
compute  Chf=1.
end if .

You can also save work by changeing

if chf=1 CCI=1.
if valve=1 CCI=1.
if pulmcirc=1 CCI=1.
if perivasc=1 CCI=1.
if htn=1 CCI=1.
if htncx=1 CCI=1.
if phtpreg=1 CCI=1.
if htnwochf=1 CCI=1.
if htnwhf=1 CCI=1.
if hrenworf=1 CCI=1.

to

if  any(1,chf , valve , pulmcirc , perivasc , htn , htncx , phtpreg ,
htnwochf , htnwhf , hrenworf ) .


Good luck

Hillel Vardi
BGU

Suh-Ing Amy Hsieh wrote:

> Hi list users:
> I am working on the dataset for my dissertation using the HCUP comorbidity
> algorithm. I use 30 conditions for creating comorbidity using string
> ICD9CM_code to ICD9CM_code_4. The first part of syntax works but the second
> part of syntax does not work for me. Any suggestions are highly thanked.
> Amy
>
> **ICD9CM algorithm using HCUP 3.3 version of Elixhauser comorbidity (2008)**
> **Set new variable to count=0 (rather than missing)**
> COMPUTE chf=0.
> COMPUTE valve=0.
> COMPUTE pulmcirc=0.
> COMPUTE perivasc=0.
> COMPUTE htn=0.
> COMPUTE htncx=0.
> COMPUTE htnpreg=0.
> COMPUTE htnwochf =0.
> COMPUTE htnwhf=0.
> COMPUTE hrenworf=0.
> COMPUTE hrenwrf=0.
> COMPUTE hhrwohrf=0.
> COMPUTE hhrwchf=0.
> COMPUTE hhrwrf=0.
> COMPUTE hhrwhrf=0.
> COMPUTE ohtnpreg=0.
> COMPUTE para=0.
> COMPUTE neuro=0.
> COMPUTE chrnlung=0.
> COMPUTE dm=0.
> COMPUTE dmcx=0.
> COMPUTE hypothy=0.
> COMPUTE renlfail=0.
> COMPUTE liver=0.
> COMPUTE ulcer=0.
> COMPUTE aids=0.
> COMPUTE lymph=0.
> COMPUTE mets=0.
> COMPUTE tumor=0.
> COMPUTE arth=0.
> COMPUTE coag=0.
> COMPUTE obese=0.
> COMPUTE wghtloss=0.
> COMPUTE lytes=0.
> COMPUTE bldloss=0.
> COMPUTE anemdef=0.
> COMPUTE alcohol=0.
> COMPUTE drug=0.
> COMPUTE psych=0.
> COMPUTE depress=0.
> COMPUTE CCI=0.
> EXECUTE.
>
> **Create flag variables for each ICD9CM_code**
> DO REPEAT dx=ICD9CM_code  TO ICD9CM_code_4.
> VECTOR dx=ICD9CM_code TO ICD9CM_code_4.
> LOOP #d = 1 TO 5.
> +  IF (dx='39891' '4280' '4281' '4289') chf = 1.
> +  IF (dx='09320' '09321' '09322' '09323' '09324'  '3940'
>        '3941' '3942' '3949' '3950' '3951' '3952' '3959'
>        '3960' '3961' '3962' '3963' '3968' '3969' '3970'
>        '3971' '3979' '4240' '4241' '4242' '4243' '42490'
>        '42491' '42499' '7463' '7464' '7465' '7466' 'V422'
>        'V433') valve=1.
> +  IF (dx='41511' '41519' '4160' '4161' '4168' '4169' '4179') pulmcirc=1.
> END IF.
> END REPEAT.
> END LOOP.
> EXECUTE.
>
> **Create one variable reflecting comorbidity**.
> if chf=1 CCI=1.
> if valve=1 CCI=1.
> if pulmcirc=1 CCI=1.
> if perivasc=1 CCI=1.
> if htn=1 CCI=1.
> if htncx=1 CCI=1.
> if phtpreg=1 CCI=1.
> if htnwochf=1 CCI=1.
> if htnwhf=1 CCI=1.
> if hrenworf=1 CCI=1.
> if hrenwrf=1 CCI=1.
> if hhrwohrf=1 CCI=1.
> if hhrwchf=1 CCI=1.
> if hhrwrf=1 CCI=1.
> if hhrwhrf=1 CCI=1.
> if ohtnpreg=1 CCI=1.
> if para=1 CCI=1.
> if neuro=1 CCO=1.
> if chrnlung=1 CCI=1.
> if dm=1 CCI=1.
> if dmcx=1 CCI=1.
> if hypothy=1 CCI=1.
> if renlfail=1 CCI=1.
> if liver=1 CCI=1.
> if ulcer=1 CCI=1.
> if aids=1 CCI=1.
> if lymph=1 CCI=0.
> if mets=1 CCI=0.
> if tumor=1 CCI=0.
> if arth=1 CCI=1.
> if coag=1 CCI=1.
> if obese=1 CCI=1.
> if wghtloss=1 CCI=1.
> if lytes=1 CCI=1.
> if bldloss=1 CCI=1.
> if anemdef=1 CCI=1.
> if alcohol=1 CCI=1.
> if drug=1 CCI=1.
> if psych=1 CCI=1.
> if depress=1 CCI=1.
>
> **Initialize hypertension, CHF, and renal comorbidity flags to 1 using the
> detail hypertension flags**
> if htnpreg=1 THEN htncx=1.
> if htnwochf=1 THEN htncx=1.
> if htnchf=1 THEN DO.
> Htncx=1.
> Chf=1.
> END.
>
> If hrenworf=1 THEN htncx=1.
> If hrenwrf=1 THEN DO.
> Htncx=1.
> Renlfail=1.
> END.
>
> If hhrwohrf=1 THEN htncx=1.
> If hhrwchf=1 THEN DO.
> Htncx=1.
> Chf=1.
> END.
>
> If hhrwrf=1 THEN DO.
> Htncx=1.
> Renlfail=1.
> END.
>
> If hhrwhrf=1 THEN DO.
> Htncx=1.
> Chf=1
> Renlfail=1.
> END.
>
> If ohtnpreg=1 THEN htncx=1.
>
> **set up code to only count the more severe comorbidity**
> if htncx=1 THEN htn=0.
> if mets=1 THEN tumor=0.
> if dmcx=1 THEN dm=0.
>
> COMPUTE MEANSUB=MEAN(ICD9CM_code TO ICD9CM_code_4).
> FREQUENCIES
>  VARIABLES=CCI
>  /ORDER=  ANALYSIS .
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: SPSS syntax for comorbidity

Richard Ristow
In reply to this post by ViAnn Beadle
At 02:05 PM 4/22/2008, ViAnn Beadle wrote:

[Regarding]
>>+  IF (dx='39891' or dx='4280' or dx='4281' or dx='4289') chf = 1.
>
>The ANY function might be easier to use here.

Quite right. RECODE ... INTO could be easier still; among other
things, it wouldn't require pre-setting the target variables to 0:

RECODE dx
    ('39891', '4280', '4281', '4289' = 1)
    (ELSE                            = 0)
    INTO chf.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: SPSS syntax for comorbidity

Peck, Jon
Nor would ANY:

COMPUTE chf = ANY(dx, '39891, etc)

That seems to me to be the clearest syntax (at least if you are not using Python :-)).


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Richard Ristow
Sent: Tuesday, April 22, 2008 4:28 PM
To: [hidden email]
Subject: Re: [SPSSX-L] SPSS syntax for comorbidity

At 02:05 PM 4/22/2008, ViAnn Beadle wrote:

[Regarding]
>>+  IF (dx='39891' or dx='4280' or dx='4281' or dx='4289') chf = 1.
>
>The ANY function might be easier to use here.

Quite right. RECODE ... INTO could be easier still; among other
things, it wouldn't require pre-setting the target variables to 0:

RECODE dx
    ('39891', '4280', '4281', '4289' = 1)
    (ELSE                            = 0)
    INTO chf.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: SPSS syntax for comorbidity

Richard Ristow
Responding to my writing that "among other things, RECODE wouldn't
require pre-setting the target variables to 0", at 05:01 PM
4/22/2008, Peck, Jon wrote:

>Nor would ANY:
>COMPUTE chf = ANY(dx, '39891, etc)

Nice!

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD