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