conditional compute syntax incorrect

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

conditional compute syntax incorrect

J McClure
I am now calculating the score of a 9 item depression questionnaire
(PHQ-9). I have dichotomized the 9 questions into the variables
PHQ_tiredS, PHQ_sleepS,  PHQ_eatS, PHQ_concS, PHQ_badS,  PHQ_movemtS,
PHQ_anhedS,  PHQ_downS, and PHQ_deathS (0=no and 1=yes). The criteria
for the new variable ( MajDeprsn) to be positive (yes=1) is two part.
First either PHQ_anhedS or  PHQ_downS must be positive (=1) and then the
sum of all 9 variables must be 5 or greater. Results from this code are
all 482 cases=0. I think my parenthesis are wrong.  Thanks, Jan


Compute MajDeprsn=0.
  If (PHQ_anhedS=1 or PHQ_downS=1) and sum(PHQ_tiredS PHQ_sleepS
PHQ_eatS PHQ_concS PHQ_badS
   PHQ_movemtS PHQ_anhedS PHQ_downS PHQ_deathS) ge5   MajDeprsn=1.
  FREQUENCIES  MajDeprsn.

=====================
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: conditional compute syntax incorrect

Samir Paul-2
Aren't u forgetting the commas in between the operands for sum? Hope you are keeping a space between ge operator and the value 5. Put the EXECUTE command to execute.
 
HTH.
 
Samir Paul
382 Main Street
ON M4C 4X8, Toronto
Canada
Cell - (416) 570 5696
Home - (416) 686 9958
Fax - (416) 686 9958
Skype - paulsamir.2009



From: J McClure <[hidden email]>
To: [hidden email]
Sent: Sat, August 7, 2010 9:47:19 AM
Subject: conditional compute syntax incorrect

I am now calculating the score of a 9 item depression questionnaire
(PHQ-9). I have dichotomized the 9 questions into the variables
PHQ_tiredS, PHQ_sleepS,  PHQ_eatS, PHQ_concS, PHQ_badS,  PHQ_movemtS,
PHQ_anhedS,  PHQ_downS, and PHQ_deathS (0=no and 1=yes). The criteria
for the new variable ( MajDeprsn) to be positive (yes=1) is two part.
First either PHQ_anhedS or  PHQ_downS must be positive (=1) and then the
sum of all 9 variables must be 5 or greater. Results from this code are
all 482 cases=0. I think my parenthesis are wrong.  Thanks, Jan


Compute MajDeprsn=0.
If (PHQ_anhedS=1 or PHQ_downS=1) and sum(PHQ_tiredS PHQ_sleepS
PHQ_eatS PHQ_concS PHQ_badS
  PHQ_movemtS PHQ_anhedS PHQ_downS PHQ_deathS) ge5  MajDeprsn=1.
FREQUENCIES  MajDeprsn.

=====================
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: conditional compute syntax incorrect

John F Hall
In reply to this post by J McClure
Jan
 
If your variables are not contiguous in the file, try putting commas in between the variable names in your syntax.  Are you sure the commands start in column one?  They seem to be inset in your mail.
 
This needs breaking up so you can see what you are doing.  Do it step by step.  Start by counting the yes responses to all 9.  If I've understood you correctly, you should be able to copy and paste the syntax below.  If there are missing data you may need to do
 
compute index3 =
    sum.9 (PHQ_tiredS,  PHQ_sleepS, PHQ_eatS,PHQ_concS, PHQ_badS,  PHQ_movemtS,
                PHQ_anhedS,  PHQ_downS, PHQ_deathS ) .
 
John
 
count index1 = PHQ_tiredS, PHQ_sleepS,  PHQ_eatS, PHQ_concS, PHQ_badS, 
                            PHQ_movemtS, PHQ_anhedS,  PHQ_downS,  PHQ_deathS (1) .
 freq index1.
 
count index2 = PHQ_anhedS,  PHQ_downS (1) .
freq index2 .
cro index1 by index2 .
 
if ((index2 ge 5) and (index2 GE 1)) MajDeprsn = 1.
freq index1.
 
 
 
----- Original Message -----
Sent: Saturday, August 07, 2010 6:47 PM
Subject: conditional compute syntax incorrect


I am now calculating the score of a 9 item depression questionnaire
(PHQ-9). I have dichotomized the 9 questions into the variables
PHQ_tiredS, PHQ_sleepS,  PHQ_eatS, PHQ_concS, PHQ_badS,  PHQ_movemtS,
PHQ_anhedS,  PHQ_downS, and PHQ_deathS (0=no and 1=yes). The criteria
for the new variable ( MajDeprsn) to be positive (yes=1) is two part.
First either PHQ_anhedS or  PHQ_downS must be positive (=1) and then the
sum of all 9 variables must be 5 or greater. Results from this code are
all 482 cases=0. I think my parenthesis are wrong.  Thanks, Jan


Compute MajDeprsn=0.
  If (PHQ_anhedS=1 or PHQ_downS=1) and sum(PHQ_tiredS PHQ_sleepS
PHQ_eatS PHQ_concS PHQ_badS
   PHQ_movemtS PHQ_anhedS PHQ_downS PHQ_deathS) ge5   MajDeprsn=1.
  FREQUENCIES  MajDeprsn.

=====================
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