Spss Query

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

Spss Query

Manoj Soni

What is the command for closing a spss data file and open a new file after saving old file using Spss Syntax

 

I am trying this.

 

GET

  FILE='D:\SPSSKRFP\b.sav'.

 

COMPUTE MID = B1 .

EXECUTE .

 

*Define Variable Properties.

*MID.

FORMATS MID (F8.0).

EXECUTE.

 

SAVE OUTFILE='D:\SPSSKRFP\b.sav' /COMPRESSED.

 

************************** All computation are happening. But here I want to save and close B.sav and  open D.sav as per my syntax.

GET

  FILE='D:\SPSSKRFP\d.sav'.

 

COMPUTE MID = D1 .

EXECUTE .

 

*Define Variable Properties.

*MID.

FORMATS MID (F8.0).

EXECUTE.

 

SAVE OUTFILE='D:\SPSSKRFP\d.sav' /COMPRESSED.

 

 

The file B is not being closed in my syntax. My Syntax says open b.sav. do something and after saving b.sav. I want to open D.sav and do something ……

 

I hope u get my problem

How it can be done.

 

With Regards

 

Manoj

India.

 

Reply | Threaded
Open this post in threaded view
|

Re: Spss Query

John F Hall

Here’s where the GUI menus come in useful.

To open a *.sav file, just navigate to it and double click on it.  To close it click on the red X: if you’ve made changes it will ask you if you want to save them.

To save a file with a new name, click on File > Save as … Navigate to folder , write name and save.  SPSS remembers the last folder visited.  Have a look at the entry level syntax-based tutorials on my site.

 

 

John F Hall

 

[hidden email]

www.surveyresearch.weebly.com

 

 

 

 

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Manoj Soni
Sent: 17 August 2011 09:42
To: [hidden email]
Subject: Spss Query

 

What is the command for closing a spss data file and open a new file after saving old file using Spss Syntax

 

I am trying this.

 

GET

  FILE='D:\SPSSKRFP\b.sav'.

 

COMPUTE MID = B1 .

EXECUTE .

 

*Define Variable Properties.

*MID.

FORMATS MID (F8.0).

EXECUTE.

 

SAVE OUTFILE='D:\SPSSKRFP\b.sav' /COMPRESSED.

 

************************** All computation are happening. But here I want to save and close B.sav and  open D.sav as per my syntax.

GET

  FILE='D:\SPSSKRFP\d.sav'.

 

COMPUTE MID = D1 .

EXECUTE .

 

*Define Variable Properties.

*MID.

FORMATS MID (F8.0).

EXECUTE.

 

SAVE OUTFILE='D:\SPSSKRFP\d.sav' /COMPRESSED.

 

 

The file B is not being closed in my syntax. My Syntax says open b.sav. do something and after saving b.sav. I want to open D.sav and do something ……

 

I hope u get my problem

How it can be done.

 

With Regards

 

Manoj

India.

 

Reply | Threaded
Open this post in threaded view
|

Re: Spss Query

Bruce Weaver
Administrator
In reply to this post by Manoj Soni
Does your version support multiple datasets?  If it does, do you use multiple datasets?  In the example you show below, no dataset names were assigned.  In that case, when you open the second file, the first one will be closed.

With dataset names, it would be something like:

GET FILE='D:\SPSSKRFP\b.sav'.
dataset name B.
* do your computations, without most (or all) of the EXECUTES.
SAVE OUTFILE='D:\SPSSKRFP\b.sav' /COMPRESSED.

GET FILE='D:\SPSSKRFP\d.sav'.
dataset name D.
dataset close B.
* computations on file D.
SAVE OUTFILE='D:\SPSSKRFP\d.sav' /COMPRESSED.

* use NEW FILE if you want to close D now.
new file.
dataset close D. /* or close ALL to close all but the new file.

HTH.


Manoj Soni wrote
What is the command for closing a spss data file and open a new file after
saving old file using Spss Syntax



I am trying this.



GET

  FILE='D:\SPSSKRFP\b.sav'.



COMPUTE MID = B1 .

EXECUTE .



*Define Variable Properties.

*MID.

FORMATS MID (F8.0).

EXECUTE.



SAVE OUTFILE='D:\SPSSKRFP\b.sav' /COMPRESSED.



************************** All computation are happening. But here I want to
save and close B.sav and  open D.sav as per my syntax.

GET

  FILE='D:\SPSSKRFP\d.sav'.



COMPUTE MID = D1 .

EXECUTE .



*Define Variable Properties.

*MID.

FORMATS MID (F8.0).

EXECUTE.



SAVE OUTFILE='D:\SPSSKRFP\d.sav' /COMPRESSED.





The file B is not being closed in my syntax. My Syntax says open b.sav. do
something and after saving b.sav. I want to open D.sav and do something ..



I hope u get my problem

How it can be done.



With Regards



Manoj

India.
--
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: Spss Query

Garry Gelade
In reply to this post by Manoj Soni

Manoj

 

Look at the suite of DATASET commands. They provide servces for opening and closing multiple datasets (ie files) via syntax.  One method is to get your first file into a named dataset, do your tranformations, save it, then get your next file into a different dataset, and then close the first dataset.  Or you could open both files first into their own named datasets, activate the first one and work on it, then save it and close the dataset, leaving the second one active to be worked on.

 

Garry Gelade

 

 

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Manoj Soni
Sent: 17 August 2011 08:42
To: [hidden email]
Subject: Spss Query

 

What is the command for closing a spss data file and open a new file after saving old file using Spss Syntax

 

I am trying this.

 

GET

  FILE='D:\SPSSKRFP\b.sav'.

 

COMPUTE MID = B1 .

EXECUTE .

 

*Define Variable Properties.

*MID.

FORMATS MID (F8.0).

EXECUTE.

 

SAVE OUTFILE='D:\SPSSKRFP\b.sav' /COMPRESSED.

 

************************** All computation are happening. But here I want to save and close B.sav and  open D.sav as per my syntax.

GET

  FILE='D:\SPSSKRFP\d.sav'.

 

COMPUTE MID = D1 .

EXECUTE .

 

*Define Variable Properties.

*MID.

FORMATS MID (F8.0).

EXECUTE.

 

SAVE OUTFILE='D:\SPSSKRFP\d.sav' /COMPRESSED.

 

 

The file B is not being closed in my syntax. My Syntax says open b.sav. do something and after saving b.sav. I want to open D.sav and do something ……

 

I hope u get my problem

How it can be done.

 

With Regards

 

Manoj

India.