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 (November 2006)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 9 Nov 2006 11:22:30 -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: a strange !IF results within a macro
Comments: To: Merav Seifan <merav.seifan@uni-tuebingen.de>
In-Reply-To:  <6.1.2.0.0.20061109110637.01a1e0c8@bbvms01.mail.uni-tuebing en.de>
Content-Type: text/plain; charset="us-ascii"; format=flowed

At 05:19 AM 11/9/2006, Merav Seifan wrote:

You've had good advice, but this is the central problem:

>I am trying to create a macro, whose final goal is to preform >different task according to the value of a certain variable within a >file (using a !IF function within the macro).

That can't work. Macros are expanded, and turned into plain SPSS syntax, before files are read. "!IF" never sees the values within a file. It is used to control the macro expansion - the SPSS code that the macro generates - by testing macro arguments and macro variables.

In addition,

>I discover some non-rational results while using the !IF command: >[...] >In this example I tried the following combinations: > 1 < 2 (O.K.); 1 < 02 (false result) ; 1 < 20 (O.K.) >10 < 2 (false result) ; 10 < 02 (O.K.) ; 10 < 20 (O.K.) >01 < 2 (O.K.); 01 < 02 (O.K.); 01 < 20 (O.K.).

You'll see that these are valid STRING comparisons. It's true in regular SPSS as well: 1<2 (numeric), but '02'>'1' (string). (You shouldn't have found "10 < 02". Did you enter that wrong?)

Macro values are strings, and are compared that way.

Post again, with what you're trying to do; it isn't clear enough from your example, to make suggestions.

-Good luck, Richard


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