>The FINISH command is not permitted when using the SPSS Statistics Manager

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

>The FINISH command is not permitted when using the SPSS Statistics Manager

Albert-Jan Roskam
Hi,

Is there still any way to use the FINISH command? It seems to be specific for batch processing and/or unix like systems.
The CSR (aka FM) is not mentioning anything about this:
*  FINISH is optional in a command file and is used tomark the end of a session.
*  FINISH causes the program to stop reading commands. Anything following FINISH in theFINISH in an INCLUDE file are ignored.
command file is ignored. Any commands following is optional in a command file and is used tomark the end of a session.

On Windows, all I get when I run it is:
 >The FINISH command is not permitted when using the SPSS Statistics Manager

I also tried using SendKeys, to simulate a CTRL-plus-PERIOD key press but that had no effect either.
import SendKeys
SendKeys.SendKeys("^.")

An earlier discussion on this list made me curious about a way to stop Spss processing under certain conditions.
Sure, a RuntimeError is raised, but Spss happily continues running subsequent commands.

* sample data.
data list free /  gender (f) treatment (f).
begin data
1 1
0 1
0 2
0 9
end data.
value labels
  gender 1 "male" 0 "female" /
  treatment 1 "hysterectomy" 2 "appendectomy" 9 "lobotomy".
dataset name data.

* men can't possibly undergo a uturus extirpation.
compute impossible = (valuelabel(gender) eq "male" and valuelabel(treatment) eq "hysterectomy").
dataset declare agg.
aggregate outfile = agg /impossible = max(impossible).
dataset activate agg.
begin program.
import spss
error = False
try:
    cur = spss.Cursor()
    record = cur.fetchone()
    if 1 in record:
        error = True
        raise RuntimeError("ERROR: impossible combination of values")
finally:
    cur.close()
    spss.Submit("dataset close agg.")
    if error:
       spss.Submit("finish.")
end program.
dataset activate data.
crosstabs gender by treatment.   /* ---- this should not run, yet it does!!!.


Regards,
Albert-Jan


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a
fresh water system, and public health, what have the Romans ever done for us?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

=====================
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: >The FINISH command is not permitted when using the SPSS Statistics Manager

Mike
"Finish" was a command used in the mainframe days to end a batch
job or, if an interactive (line oriented) session was possible, to end the
session.  I believe it was the only way to have SPSS stop processing,
clean up after itself, and end all related processing.  I assume that
the Unix version is still based on this model.  With the Windows version,
Finish is unnecessary because the user presumably would point and
click to shut down the program.  It is likely that that no one thought that
someone might want to insert a "Finish" to cease processing a particular
error condition was met.  Perhaps one of the SPSS folks knows if there
is a workaround for this.

-Mike Palij
New York University
[hidden email]



On Fri, Jun 28, 2013 at 10:18 AM, Albert-Jan Roskam <[hidden email]> wrote:
Hi,

Is there still any way to use the FINISH command? It seems to be specific for batch processing and/or unix like systems.
The CSR (aka FM) is not mentioning anything about this:
*  FINISH is optional in a command file and is used tomark the end of a session.
*  FINISH causes the program to stop reading commands. Anything following FINISH in theFINISH in an INCLUDE file are ignored.
command file is ignored. Any commands following is optional in a command file and is used tomark the end of a session.

On Windows, all I get when I run it is:
 >The FINISH command is not permitted when using the SPSS Statistics Manager

I also tried using SendKeys, to simulate a CTRL-plus-PERIOD key press but that had no effect either.
import SendKeys
SendKeys.SendKeys("^.")

An earlier discussion on this list made me curious about a way to stop Spss processing under certain conditions.
Sure, a RuntimeError is raised, but Spss happily continues running subsequent commands.

* sample data.
data list free /  gender (f) treatment (f).
begin data
1 1
0 1
0 2
0 9
end data.
value labels
  gender 1 "male" 0 "female" /
  treatment 1 "hysterectomy" 2 "appendectomy" 9 "lobotomy".
dataset name data.

* men can't possibly undergo a uturus extirpation.
compute impossible = (valuelabel(gender) eq "male" and valuelabel(treatment) eq "hysterectomy").
dataset declare agg.
aggregate outfile = agg /impossible = max(impossible).
dataset activate agg.
begin program.
import spss
error = False
try:
    cur = spss.Cursor()
    record = cur.fetchone()
    if 1 in record:
        error = True
        raise RuntimeError("ERROR: impossible combination of values")
finally:
    cur.close()
    spss.Submit("dataset close agg.")
    if error:
       spss.Submit("finish.")
end program.
dataset activate data.
crosstabs gender by treatment.   /* ---- this should not run, yet it does!!!.


Regards,
Albert-Jan


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a
fresh water system, and public health, what have the Romans ever done for us?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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