Date: Tue, 13 Jun 2006 20:45:51 +0200
Reply-To: Marta García-Granero
<biostatistics@terra.es>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Marta García-Granero
<biostatistics@terra.es>
Organization: Asesoría Bioestadística
Subject: Can't !LET & VAR LABELS be used in DO IF...ELSE IF... END IF
structures in MACROs? revisited
In-Reply-To: <1812991234.20060613164213@terra.es>
Content-Type: text/plain; charset=ISO-8859-1
Hi everybody:
Since my first post presented only part of a very long MACRO, perhaps
the problem can't be easily reproduced by other people. That's why I
have written a tiny demo that shows the problem:
DATA LIST FREE/testvar.
BEGIN DATA
1 1 1 2 2 2 3 3 3
END DATA.
FORMAT testvar (F8).
DEFINE DEMOTEST(method=!TOKENS(1)).
DO IF !method EQ 1.
- VAR LABEL testvar 'Method #1 was selected'.
- !LET !label_1=!UNQUOTE('1-A').
- !LET !label_2=!UNQUOTE('1-B').
- !LET !label_3=!UNQUOTE('1-C').
ELSE IF !method EQ 2.
- VAR LABEL testvar 'Method #2 was selected'.
- !LET !label_1=!UNQUOTE('2-A').
- !LET !label_2=!UNQUOTE('2-B').
- !LET !label_3=!UNQUOTE('2-C').
ELSE.
- VAR LABEL testvar 'Other method was selected'.
- !LET !label_1=!UNQUOTE('Other-A').
- !LET !label_2=!UNQUOTE('Other-B').
- !LET !label_3=!UNQUOTE('Other-C').
END IF.
DO IF $casenum EQ 1.
- ECHO "The method used was:".
- ECHO !QUOTE(!method).
END IF.
VALUE LABEL testvar 1 !QUOTE(!QUOTE(!label_1))
2 !QUOTE(!QUOTE(!label_2))
3 !QUOTE(!QUOTE(!label_3)).
FREQUENCIES
VARIABLES=testvar.
!ENDDEFINE.
DEMOTEST method=1.
DEMOTEST method=2.
As you can see if you run this example, the last instance of the list
of DO IF... ELSE IF... ELSE is always selected.
Can anybody enlighten me?
Thanks,
Marta mailto:biostatistics@terra.es
(Anyway: my Meta-analysis MACRO is written and working properly -
using a long workaround to the above mentioned problem - and available
on request).