Date: Tue, 13 Sep 2005 09:03:58 +0200
Reply-To: MOSER Winfried <winfried.moser@statistik.gv.at>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: MOSER Winfried <winfried.moser@statistik.gv.at>
Subject: AW: Re: problem with insert inserting a macro-command
Content-Type: text/plain; charset="iso-8859-1"
thank you richard! what would i do without this list :-)
winfried
-----Ursprüngliche Nachricht-----
Von: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] Im Auftrag von Richard Ristow
Gesendet: Samstag, 10. September 2005 04:07
An: SPSSX-L@LISTSERV.UGA.EDU
Betreff: Re: problem with insert inserting a macro-command
Did anyone ever resolve this? If not, ...
At 07:59 AM 9/1/2005, MOSER Winfried wrote:
>within a macro i use a insert-command to insert the command-line !let
>!pmax=p11. ("p11" is not constant, therefore i have to use insert).
>
>the program does not accept the line and says:
>
>The first word in the line is not recognized as an SPSS command. This
>command not executed.
>
>does anyone know, why spss doesn't accept !let as an spss-command, if
>it's insertet?
You've put an INSERT into the middle of a macro definition, hoping the INSERTed code would become part of the macro definition. But it won't. Instead, the INSERT, itself, becomes part of the macro definition. The macro is expanded; the INSERT is there, and is executed; the !let statement is encountered; and, since a macro definition is not in progress at that point, it's an error. (Remember, this is the
*expanded* macro code.)
The usual solution is,
A. In the inserted file, instead of
!let !pmax=p11
have
DEFINE !pmax() p11 !ENDDEFINE.
B. Take the INSERT statement out of your macro definition. Instead, put it in your code (your 'syntax') just before the macro is invoked (is 'run'). In the macro, use the value !pmax just as you already do.
I may have some glitches here, but that's basically how to do it.
>thanks for any hint.
>
>winfried
>
>(below: error-code).
>
>
>1703 * End of INSERT and INCLUDE nesting level 01.
>1703 M> * End of INSERT and INCLUDE nesting level 01.
>1704 M> insert file='d:\temp\r5_pmax.sps'.
>1704 !let !pmax=p11.
>1704 M> !let !pmax=p11.
>
> >Error # 1. Command name: !let
> >The first word in the line is not recognized as an SPSS command. This
> >command not executed.
>
>
>Mag. Winfried Moser
>Statistik Austria
>Direktion Bevölkerung
>Analyse und Prognose
>Guglgasse 13
>1110 Wien
>T: +43 (01)71128 7039
>F: +43(01)71128 7455