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 (February 2007)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 9 Feb 2007 17:21:22 -0500
Reply-To:   Richard Ristow <wrristow@mindspring.com>
Sender:   "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:   Richard Ristow <wrristow@mindspring.com>
Subject:   Re: IF statement to overwite an existing value with a missing value
Comments:   To: "Marks, Jim" <Jim.Marks@lodgenet.com>
Comments:   cc: Gary Oliver <G.Oliver@econ.usyd.edu.au>
In-Reply-To:   <9B4E9074BAEA474FA68BCBFCD1EB81AA01E59B9C@valentino.lodgene t.com>
Content-Type:   text/plain; charset="iso-8859-1"; format=flowed

At 03:43 PM 2/9/2007, Marks, Jim wrote:

>A statement like: > >COMPUTE P01_VAR3 = $SYMSIS. >IF P01_VAR4 > 0 P01_VAR3 = P01_VAR1. > >Will reset all the values and populate P01_VAR3 with the values you >want.

Touché. That's the way we did it before DO IF was introduced. It's shorter, easier to write, and easier to get right, than the DO IF solution I gave:

>>DO IF ( P01_VAR4 > 0 ) >> AND NOT MISSING( P01_VAR4 > 0 ). >>. COMPUTE P01_VAR3 = P01_VAR1 . >>ELSE. >>. COMPUTE P01_VAR3 = $SYSMIS. >>END IF.

There's a lot to be said for remembering old-school styles.

Jim also wrote,

>It looks like you have a set of variables to process. If so, something >using DO REPEAT could reduce your typing:

Yes. Reduce your typing, make your code shorter and more readable, and be less prone to errors.

-Good luck, and thanks, Richard


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