Date: Tue, 13 Jun 2000 12:47:19 GMT0BST
Reply-To: PAUL MCGEOGHAN <Mcgeoghan@CARDIFF.AC.UK>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: PAUL MCGEOGHAN <Mcgeoghan@CARDIFF.AC.UK>
Subject: Re: loop syntax
In-Reply-To: <000101bfd473$dc2c94e0$1300000a@erc.ie>
Many thanks to Donal and others who replied to my problem.
I have tried the solution suggested by Donal below which works but I
can't seem to get it to accept for example VAR1 TO VAR3 in any way.
Rather than specifying the XVARS individually, can I use TO if the
variables are adjacent and how?
Send reply to: <Donal.Kelly@erc.ie>
From: "Donal Kelly" <Donal.Kelly@erc.ie>
To: "PAUL MCGEOGHAN" <Mcgeoghan@CARDIFF.AC.UK>
Subject: RE: loop syntax
Date sent: Mon, 12 Jun 2000 14:41:06 +0100
> Hi Paul,
>
> Basically, SPSS doesn't like doing transformations within loop or Do Repeat
> structures. You need to define a simple macro with the Y var specified. Then
> just plug in the X var names you require in to the 'macro call' and away you
> go. It doesn't matter if the vars are adjacent on the data file or not.
>
> This should do the trick (hopefully).
>
> 1. Define the macro
>
> Define MacName (vars =!Charend ('\')).
> *This calls the Y vars in turn)
> !Do !i !in (!vars).
> GRAPH
> /SCATTERPLOT(BIVAR)=YvarName WITH !i
> /MISSING=LISTWISE .
> !Doend.
> !Enddefine.
>
> 2. Call the macro
>
> *This calls the defined macro, and the specified Y variable names are
> assigned to 'vars' and substituted in turn (i) to produce scatterplots with
> your original dependent variable.
>
> MacName vars =var1 var2 var3.
>
>
> I hope this helps.
> Donal Kelly
>
>
>
> -----Original Message-----
> From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU]On Behalf Of
> PAUL MCGEOGHAN
> Sent: 12 June 2000 12:54
> To: SPSSX-L@LISTSERV.UGA.EDU
> Subject: loop syntax
>
>
> Hi,
>
> I am trying to produce some syntax which will do a number of
> scatterplots with the same dependent Y variable each time plotted
> against a number of X variables which are adjacent to each other in the
> dataset.
>
> I have produced some simple syntax which I thought would do this:
> LOOP #I=SALBEGIN TO PREVEXP.
> GRAPH
> /SCATTERPLOT(BIVAR)=salbegin WITH #I
> /MISSING=LISTWISE .
> END LOOP.
>
> Is this possible to do and why does the above give me the
> following error:
> Error # 4095. Command name: GRAPH
> >The transformations program contains an
> unclosed LOOP, DO IF, or complex
> >file structure. Use the level-of-control
> shown to the left of the SPSS
> >commands to determine the range of LOOPs and
> DO IFs.
> >This command not executed.
>
> Thanks in advance,
> Paul
>
> -----------------------------------------------
> Paul McGeoghan
> Application Support Specialist
> (Statistics and databases support)
> Information Services
> Cardiff University
> 40-41 Park Place
> CARDIFF
> (029) 20875035
>
>
-----------------------------------------------
Paul McGeoghan
Application Support Specialist
(Statistics and databases support)
Information Services
Cardiff University
40-41 Park Place
CARDIFF
(029) 20875035
|