dataset close

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

dataset close

drfg2008
Is there an SPSS command that closes all datasets except a specified one? Something like "DATASET KEEP".

Would make things easier.
Dr. Frank Gaeth

Reply | Threaded
Open this post in threaded view
|

Re: dataset close

Kirill Orlov
DATASET CLOSE ALL
closes all datasets except the working one

28.05.2014 14:55, drfg2008 пишет:
Is there an SPSS command that closes all datasets except a specified one?
Something like "DATASET KEEP".

Would make things easier.



-----
Dr. Frank Gaeth
FU-Berlin

--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/dataset-close-tp5726242.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




Reply | Threaded
Open this post in threaded view
|

Re: dataset close

Jon K Peck
In reply to this post by drfg2008
No, but this program will do it.
begin program.
keep = "DataSet2"
import spss, spssaux
res, error = spssaux.createXmlOutput("DATASET DISPLAY", omsid='Dataset Display', subtype='Datasets')
datasets = spssaux.getValuesFromXmlWorkspace(res, 'Datasets', colCategory="Datasets")
for d in datasets:
  if d.lower() != keep.lower():
    spss.Submit("DATASET CLOSE %s" % d)
end program.

As for Kiril's note,

DATASET CLOSE ALL
closes all datasets except the working one


what it really does is to remove all of the dataset names, which has the side effect of closing all the files except for the active dataset, but it also removes the dataset name from the active dataset, which may be undesirable.


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




From:        drfg2008 <[hidden email]>
To:        [hidden email],
Date:        05/28/2014 04:56 AM
Subject:        [SPSSX-L] dataset close
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Is there an SPSS command that closes all datasets except a specified one?
Something like "DATASET KEEP".

Would make things easier.



-----
Dr. Frank Gaeth
FU-Berlin

--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/dataset-close-tp5726242.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


Reply | Threaded
Open this post in threaded view
|

Re: dataset close

Bruce Weaver
Administrator
"what [DATASET CLOSE ALL] really does is to remove all of the dataset names, which has the side effect of closing all the files except for the active dataset, but it also removes the dataset name from the active dataset, which may be undesirable."

But presumably, one could follow DATASET CLOSE ALL with a DATASET NAME command to reinstate the dataset name, if it was needed for something.  Right?



Jon K Peck wrote
No, but this program will do it.
begin program.
keep = "DataSet2"
import spss, spssaux
res, error = spssaux.createXmlOutput("DATASET DISPLAY", omsid='Dataset
Display', subtype='Datasets')
datasets = spssaux.getValuesFromXmlWorkspace(res, 'Datasets',
colCategory="Datasets")
for d in datasets:
  if d.lower() != keep.lower():
    spss.Submit("DATASET CLOSE %s" % d)
end program.

As for Kiril's note,

DATASET CLOSE ALL
closes all datasets except the working one

what it really does is to remove all of the dataset names, which has the
side effect of closing all the files except for the active dataset, but it
also removes the dataset name from the active dataset, which may be
undesirable.


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




From:   drfg2008 <[hidden email]>
To:     [hidden email],
Date:   05/28/2014 04:56 AM
Subject:        [SPSSX-L] dataset close
Sent by:        "SPSSX(r) Discussion" <[hidden email]>



Is there an SPSS command that closes all datasets except a specified one?
Something like "DATASET KEEP".

Would make things easier.



-----
Dr. Frank Gaeth
FU-Berlin

--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/dataset-close-tp5726242.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
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: dataset close

Kirill Orlov
I find DATASET CLOSE ALL very convenient, all the more that I often work and like to work with an unnamed dataset

Reply | Threaded
Open this post in threaded view
|

Re: dataset close

Rick Oliver-3
In reply to this post by drfg2008
dataset activate [name].
dataset close all.

The active dataset remains open but unnamed.

Rick Oliver
Senior Information Developer
IBM Business Analytics (SPSS)
E-mail: [hidden email]




From:        drfg2008 <[hidden email]>
To:        [hidden email],
Date:        05/28/2014 05:59 AM
Subject:        dataset close
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Is there an SPSS command that closes all datasets except a specified one?
Something like "DATASET KEEP".

Would make things easier.



-----
Dr. Frank Gaeth
FU-Berlin

--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/dataset-close-tp5726242.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


Reply | Threaded
Open this post in threaded view
|

Re: dataset close

Kirill Orlov
dataset close all.
[operations]
dataset name OK_if_you_want_name.
[operations]

28.05.2014 17:54, Rick Oliver пишет:
dataset activate [name].
dataset close all.

The active dataset remains open but unnamed.

Rick Oliver
Senior Information Developer
IBM Business Analytics (SPSS)
E-mail: [hidden email]




From:        drfg2008 [hidden email]
To:        [hidden email],
Date:        05/28/2014 05:59 AM
Subject:        dataset close
Sent by:        "SPSSX(r) Discussion" [hidden email]




Is there an SPSS command that closes all datasets except a specified one?
Something like "DATASET KEEP".

Would make things easier.



-----
Dr. Frank Gaeth
FU-Berlin

--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/dataset-close-tp5726242.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




Reply | Threaded
Open this post in threaded view
|

Re: dataset close

Jon K Peck
In reply to this post by Bruce Weaver
Sure, but one would want to active the keeper dataset first, as long as you are aware of the behavior.


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




From:        Bruce Weaver <[hidden email]>
To:        [hidden email],
Date:        05/28/2014 07:39 AM
Subject:        Re: [SPSSX-L] dataset close
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




"what [DATASET CLOSE ALL] really does is to remove all of the dataset names,
which has the side effect of closing all the files except for the active
dataset, but it also removes the dataset name from the active dataset, which
may be undesirable."

But presumably, one could follow DATASET CLOSE ALL with a DATASET NAME
command to reinstate the dataset name, if it was needed for something.
Right?




Jon K Peck wrote
> No, but this program will do it.
> begin program.
> keep = "DataSet2"
> import spss, spssaux
> res, error = spssaux.createXmlOutput("DATASET DISPLAY", omsid='Dataset
> Display', subtype='Datasets')
> datasets = spssaux.getValuesFromXmlWorkspace(res, 'Datasets',
> colCategory="Datasets")
> for d in datasets:
>   if d.lower() != keep.lower():
>     spss.Submit("DATASET CLOSE %s" % d)
> end program.
>
> As for Kiril's note,
>
> DATASET CLOSE ALL
> closes all datasets except the working one
>
> what it really does is to remove all of the dataset names, which has the
> side effect of closing all the files except for the active dataset, but it
> also removes the dataset name from the active dataset, which may be
> undesirable.
>
>
> Jon Peck (no "h") aka Kim
> Senior Software Engineer, IBM

> peck@.ibm

> phone: 720-342-5621
>
>
>
>
> From:   drfg2008 &lt;

> kontakt@

> &gt;
> To:

> SPSSX-L@.uga

> ,
> Date:   05/28/2014 04:56 AM
> Subject:        [SPSSX-L] dataset close
> Sent by:        "SPSSX(r) Discussion" &lt;

> SPSSX-L@.uga

> &gt;
>
>
>
> Is there an SPSS command that closes all datasets except a specified one?
> Something like "DATASET KEEP".
>
> Would make things easier.
>
>
>
> -----
> Dr. Frank Gaeth
> FU-Berlin
>
> --
> View this message in context:
>
http://spssx-discussion.1045642.n5.nabble.com/dataset-close-tp5726242.html
> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

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





-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/dataset-close-tp5726242p5726257.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


Reply | Threaded
Open this post in threaded view
|

Re: dataset close

Rick Oliver-3
In reply to this post by Kirill Orlov
Yes, that will work if a name is required.

Rick Oliver
Senior Information Developer
IBM Business Analytics (SPSS)
E-mail: [hidden email]




From:        Kirill Orlov <[hidden email]>
To:        Rick Oliver/Chicago/IBM@IBMUS, [hidden email],
Date:        05/28/2014 09:01 AM
Subject:        Re: dataset close




dataset close all.
[operations]
dataset name OK_if_you_want_name.
[operations]

28.05.2014 17:54, Rick Oliver пишет:
dataset activate [name].
dataset close all.


The active dataset remains open but unnamed.


Rick Oliver
Senior Information Developer
IBM Business Analytics (SPSS)
E-mail:
oliverr@...



From:        
drfg2008 <kontakt@...>
To:        
[hidden email],
Date:        
05/28/2014 05:59 AM
Subject:        
dataset close
Sent by:        
"SPSSX(r) Discussion" [hidden email]




Is there an SPSS command that closes all datasets except a specified one?
Something like "DATASET KEEP".

Would make things easier.



-----
Dr. Frank Gaeth
FU-Berlin

--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/dataset-close-tp5726242.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to

LISTSERV@... (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: dataset close

Ruben Geert van den Berg
In reply to this post by drfg2008
I think DATASET KEEP is a great suggestion! Closing all but one dataset (and keeping its name) is such a routine operation that it shouldn't require more than a single, short command.

The endless DATASET NAME, DATASET ACTIVATE, DATASET CLOSE commands tend to clutter up syntax files sometimes.
Reply | Threaded
Open this post in threaded view
|

Re: dataset close

Andy W
Here you go, clutter no more ;)

****************************************.
DEFINE !DATASET_KEEP (!POSITIONAL !CMDEND)
DATASET ACTIVATE !1.
DATASET CLOSE ALL.
DATASET NAME !1.
!ENDDEFINE.

DATA LIST FREE / X.
BEGIN DATA
1
END DATA.
DATASET NAME One.

DATA LIST FREE / X.
BEGIN DATA
2
END DATA.
DATASET NAME Two.

!DATASET_KEEP Two.
****************************************.
Andy W
apwheele@gmail.com
http://andrewpwheeler.wordpress.com/