Testing for an Empty Dataset

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

Testing for an Empty Dataset

Atai Winkler

Hi

 

If none of the records in a dataset satisfy a condition in a DO loop, the result can be an empty dataset. So, how can one test for an empty dataset?

 

 

Thank you.

 

 

Dr Atai Winkler

[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: Testing for an Empty Dataset

Jon Peck
SHOW N.
will display the number of cases in the active dataset, but the only way to test and take action based on this would be via Python.  For example,
begin program python3.
import spss, spssaux
casecount = spssaux.getShow("N")
if casecount > 0:
    spss.Submit("INSERT FILE='dosomething.sps'")
end program.

Another approach might be to use INSERT with ERROR=STOP,

On Mon, Dec 14, 2020 at 5:56 AM Atai Winkler <[hidden email]> wrote:

Hi

 

If none of the records in a dataset satisfy a condition in a DO loop, the result can be an empty dataset. So, how can one test for an empty dataset?

 

 

Thank you.

 

 

Dr Atai Winkler

[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


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