LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (July 2003)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 30 Jul 2003 17:13:52 +0200
Reply-To:   "Petersen, Hauke" <hauke.petersen@INTERACTIVEMEDIA.DE>
Sender:   "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:   "Petersen, Hauke" <hauke.petersen@INTERACTIVEMEDIA.DE>
Subject:   Re: do if vs if
Comments:   To: "Jed J. Teres" <jjt2002@med.cornell.edu>
Content-Type:   text/plain; charset="iso-8859-1"

Hi Jef,

there are two point, the second probably yielding a different (correct?) result in your case.

1) with do-if-s the first true condition determines which part of the syntax gets executed, ignoring all other parts.

with if-s all true conditions are executed in the sequence they are written

2) with do-if-s, if a condition can't be evaluatet due to missing values, spss skips pcorcessing until after end-if

So with do-if, if bdbj(#i) or bdpn(#i) are missing, processing skips to after end-if, ignoring your 2nd and 3rd condition, while the 2nd and 3rd if in your if-sequence gets evaluated.

HTH, Hauke

-----Ursprüngliche Nachricht----- Von: Jed J. Teres [mailto:jjt2002@med.cornell.edu] Gesendet: Mittwoch, 30. Juli 2003 16:09 An: SPSSX-L@VM.MARIST.EDU Betreff: do if vs if

Can someone please explain the difference between "do if" and just regular "if" for me? I tried to use the following syntax, and if failed:

do if (bdpj(#i) lt 3 AND bdpn(#i) lt 2). compute bdep(#i)=0. else if (bdpj(#i) lt 3 AND missing(bdpn(#i))) compute bdep(#i)=0. else if (missing(bdpj(#i)) AND bdpn(#i) ge 2) compute bdep(#i)=1. end if.

But the following worked fine. I'm coming from a MATLAB background, and I don't see a difference... what -is- the difference?

if (bdpj(#i) lt 3 AND bdpn(#i) lt 2) bdep(#i)=0. if (bdpj(#i) lt 3 AND missing(bdpn(#i))) bdep(#i)=0. if (missing(bdpj(#i)) AND bdpn(#i) ge 2) bdep(#i)=1.

Thanks-

Jedediah Teres Data Analyst Weill Medical College of Cornell University Department of Psychiatry 525 East 68th Street New York, NY 10021 (212) 746-3874


Back to: Top of message | Previous page | Main SPSSX-L page