Ending SPSS syntax when a condition is met

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

Ending SPSS syntax when a condition is met

spssx100
Hello

I have a fairly long piece of syntax. When running it, I want to end it immediately if a condition is met (ie somewhere in the middle).

More specifically...

If variable = value of interest , end the syntax immediately/perhaps show a message to say what's happened and do nothing else.

Can this be done?

Thanks.


Reply | Threaded
Open this post in threaded view
|

Re: Ending SPSS syntax when a condition is met

David Marso
Administrator
NO!
You cannot do that.
--
spssx100 wrote
Hello

I have a fairly long piece of syntax. When running it, I want to end it immediately if a condition is met (ie somewhere in the middle).

More specifically...

If variable = value of interest , end the syntax immediately/perhaps show a message to say what's happened and do nothing else.

Can this be done?

Thanks.
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Ending SPSS syntax when a condition is met

Jon K Peck
In reply to this post by spssx100
I am not clear on exactly what you want to do.  If you have a block of syntax that you want to interrupt based on some criterion,  this is possible if you use Python programmability to control the flow.  You would use the spss.Submit api to run multiple blocks of code and make appropriate checks in-between blocks.  You would probably not be looking at the value of a particular case for that.

If, on the other hand, what you want to do is to interrupt the data pass in progress if some case value meets a condition, you would need to be passing the data into Python code using one of the case-by-case apis and terminate the data pass when the condition is met.  While this is quite doable, Python data passes are slower than native ones, so there would be a performance  cost.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        spssx100 <[hidden email]>
To:        [hidden email],
Date:        04/11/2014 08:46 AM
Subject:        [SPSSX-L] Ending SPSS syntax when a condition is met
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Hello

I have a fairly long piece of syntax. When running it, I want to end it
immediately if a condition is met (ie somewhere in the middle).

More specifically...

If variable = value of interest , end the syntax immediately/perhaps show a
message to say what's happened and do nothing else.

Can this be done?

Thanks.






--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Ending-SPSS-syntax-when-a-condition-is-met-tp5725396.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

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