LEAVE function

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

LEAVE function

Mark Gunty
For the LEAVE function, the example in the SPSS 26 syntax reference guide reads: 

*this is the correct form.
COMPUTE TotalVar1=TotalVar1+Var1.
LEAVE TotalVar1.

When I run the following syntax (which looks to me a lot like the example), I get an error message:

compute composite_tot=composite_tot + composite .
leave composite_tot . 
 
>Error # 4286 in column 7.  Text: composite_tot
>Illegal reference to variable in working file.

Any solutions out there?

BTW, I know that other functions do things like LEAVE, but none can efficiently to what I want.

Gratefully,
M Gunty
University of Notre Dame
===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: LEAVE function

Jon Peck
Are you sure that you selected and ran the COMPUTE along with the LEAVE command?

On Tue, Jun 25, 2019 at 1:11 PM Mark Gunty <[hidden email]> wrote:
For the LEAVE function, the example in the SPSS 26 syntax reference guide reads: 

*this is the correct form.
COMPUTE TotalVar1=TotalVar1+Var1.
LEAVE TotalVar1.

When I run the following syntax (which looks to me a lot like the example), I get an error message:

compute composite_tot=composite_tot + composite .
leave composite_tot . 
 
>Error # 4286 in column 7.  Text: composite_tot
>Illegal reference to variable in working file.

Any solutions out there?

BTW, I know that other functions do things like LEAVE, but none can efficiently to what I want.

Gratefully,
M Gunty
University of Notre Dame
===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD


--
Jon K Peck
[hidden email]

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: LEAVE function

Mario Giesel-2
I think the error occurs when your composite_tot already exists in the database as explained in the syntax reference:

*this will change the value of Var2 but LEAVE will fail,
generating an error because Var2 already exists.
COMPUTE Var2=Var2+Var2.
LEAVE Var2.


Mario Giesel
Munich, Germany


Am Dienstag, 25. Juni 2019, 21:42:08 MESZ hat Jon Peck <[hidden email]> Folgendes geschrieben:


Are you sure that you selected and ran the COMPUTE along with the LEAVE command?

On Tue, Jun 25, 2019 at 1:11 PM Mark Gunty <[hidden email]> wrote:
For the LEAVE function, the example in the SPSS 26 syntax reference guide reads: 

*this is the correct form.
COMPUTE TotalVar1=TotalVar1+Var1.
LEAVE TotalVar1.

When I run the following syntax (which looks to me a lot like the example), I get an error message:

compute composite_tot=composite_tot + composite .
leave composite_tot . 
 
>Error # 4286 in column 7.  Text: composite_tot
>Illegal reference to variable in working file.

Any solutions out there?

BTW, I know that other functions do things like LEAVE, but none can efficiently to what I want.

Gratefully,
M Gunty
University of Notre Dame
===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD


--
Jon K Peck
[hidden email]

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: LEAVE function

David Marso-2
In reply to this post by Mark Gunty
"BTW, I know that other functions do things like LEAVE, but none can efficiently to what I want."

Curious as to what you are referring to here.

COMPUTE CumSumX=SUM(x,LAG(CumSumX)).
or
CREATE CumSumX=CSUM(x).

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: LEAVE function

Mario Giesel-2
I like

CREATE CumSumX = CSUM(x).

much more than the awkward

COMPUTE Totalx = Totalx + x.
LEAVE Totalx.

However,

COMPUTE CumSumX=SUM(x,LAG(CumSumX)).

seems to produce weird results?!

Mario Giesel
Munich, Germany


Am Mittwoch, 26. Juni 2019, 22:32:02 MESZ hat David Marso <[hidden email]> Folgendes geschrieben:


"BTW, I know that other functions do things like LEAVE, but none can efficiently to what I want."

Curious as to what you are referring to here.

COMPUTE CumSumX=SUM(x,LAG(CumSumX)).
or
CREATE CumSumX=CSUM(x).

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: LEAVE function

Mario Giesel-2
Nope, my mistake.

COMPUTE CumSumX=SUM(x,LAG(CumSumX)).

also works!

Mario Giesel
Munich, Germany


Am Donnerstag, 27. Juni 2019, 15:05:17 MESZ hat Mario Giesel <[hidden email]> Folgendes geschrieben:


I like

CREATE CumSumX = CSUM(x).

much more than the awkward

COMPUTE Totalx = Totalx + x.
LEAVE Totalx.

However,

COMPUTE CumSumX=SUM(x,LAG(CumSumX)).

seems to produce weird results?!

Mario Giesel
Munich, Germany


Am Mittwoch, 26. Juni 2019, 22:32:02 MESZ hat David Marso <[hidden email]> Folgendes geschrieben:


"BTW, I know that other functions do things like LEAVE, but none can efficiently to what I want."

Curious as to what you are referring to here.

COMPUTE CumSumX=SUM(x,LAG(CumSumX)).
or
CREATE CumSumX=CSUM(x).

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD