SAVE OUTFILE to the same filename

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

SAVE OUTFILE to the same filename

Georg Maubach
Hi All,

we have set up a syntax program that creates a dataset from two
different files. We would like to match a third one but we get the
following error message:

----- cut -----
SAVE
    OUTFILE = '...cut...\03_Countries\NZ\' +
           '10_Data_Analysis\02_Data\' +
           '23_50_00_85_DHL_GFW_CS_2_2007_NZ_matched.sav'
   /COMPRESSED .

>Warning # 5334.  Command name: SAVE
>The SAVE command has succeeded.  However, due to contention for the
>specified file, the data have been saved to a file with a different
name.

>Saved to ...cut...\02_Custo. (rest of filename is missing)
----- cut -----

The syntax run is as follows:

1. Step: Load Excel file no. 1 with customer information and do some
data transformations
2. Step: Save Excel file no. 1 with SAVE OUTFILE as an SAV file
3. Step: Load dataset file no. 2 with answers of respondents as SAV file
4. Step: Match file no. 1 to file no. 2 (as SAV)
5. Step: Save matched file with SAVE OUTFILE to file "xyz.sav"
6. Step: Load Excel file no. 3 with open-ended questions and do some
data transformations
7. Step: Save Excel file no. 3 with SAVE OUTFILE as an SAV file
8. Step: Load dataset "xyz.sav"
9. Step: Match file "xyz.sav" and file no. 3 (as SAV)
10. Step. Save matched file with SAVE OUTFILE to file 'xyz.sav'

In the 10th Step we get the above mentioned error message.

To me it looks like as if SPSS does not free the allocated file name if
a new file is loaded during single syntax run. In other syntax programs
we use different file names like "temp1.sav", "temp2.sav", "temp3.sav"
and so forth. But this time we need the process exactly as described
because we have set up a system of many depending programs that now need
to be extended.

SPSS is changing the file name to one that SPSS likes but we need
exactly the one we chose because other syntax programs refer to it.

Is there a way to tell SPSS that it should overwrite the old dataset
during a single SPSS syntax run?

Regards

Georg Maubach
Market Analyst
Reply | Threaded
Open this post in threaded view
|

Re: SAVE OUTFILE to the same filename

Arlin Cuncic-2
Based on the error message it sounds like you may have two copies of the
dataset open - one that was open from Step 5, and the second one that you
are working with in Step 10.  There was some discussion on the list last
week about how to use syntax to close open datasets - perhaps someone else
can advise, I didn't save those messages.

Arlin

[hidden email] on Wednesday, May 30, 2007 at 8:24 AM -0500 wrote:

>Hi All,
>
>we have set up a syntax program that creates a dataset from two
>different files. We would like to match a third one but we get the
>following error message:
>
>----- cut -----
>SAVE
>    OUTFILE = '...cut...\03_Countries\NZ\' +
>           '10_Data_Analysis\02_Data\' +
>           '23_50_00_85_DHL_GFW_CS_2_2007_NZ_matched.sav'
>   /COMPRESSED .
>
>>Warning # 5334.  Command name: SAVE
>>The SAVE command has succeeded.  However, due to contention for the
>>specified file, the data have been saved to a file with a different
>name.
>
>>Saved to ...cut...\02_Custo. (rest of filename is missing)
>----- cut -----
>
>The syntax run is as follows:
>
>1. Step: Load Excel file no. 1 with customer information and do some
>data transformations
>2. Step: Save Excel file no. 1 with SAVE OUTFILE as an SAV file
>3. Step: Load dataset file no. 2 with answers of respondents as SAV file
>4. Step: Match file no. 1 to file no. 2 (as SAV)
>5. Step: Save matched file with SAVE OUTFILE to file "xyz.sav"
>6. Step: Load Excel file no. 3 with open-ended questions and do some
>data transformations
>7. Step: Save Excel file no. 3 with SAVE OUTFILE as an SAV file
>8. Step: Load dataset "xyz.sav"
>9. Step: Match file "xyz.sav" and file no. 3 (as SAV)
>10. Step. Save matched file with SAVE OUTFILE to file 'xyz.sav'
>
>In the 10th Step we get the above mentioned error message.
>
>To me it looks like as if SPSS does not free the allocated file name if
>a new file is loaded during single syntax run. In other syntax programs
>we use different file names like "temp1.sav", "temp2.sav", "temp3.sav"
>and so forth. But this time we need the process exactly as described
>because we have set up a system of many depending programs that now need
>to be extended.
>
>SPSS is changing the file name to one that SPSS likes but we need
>exactly the one we chose because other syntax programs refer to it.
>
>Is there a way to tell SPSS that it should overwrite the old dataset
>during a single SPSS syntax run?
>
>Regards
>
>Georg Maubach
>Market Analyst
>
>



Arlin Cuncic, M.A.
Research and Assessment Associate
Research and Assessment Department
Thames Valley District School Board
1250 Dundas St.
London, ON N5W 5P2
519-452-2000 ext. 20115
[hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: SAVE OUTFILE to the same filename

Beadle, ViAnn
In reply to this post by Georg Maubach
Look at DATASET CLOSE.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Georg Maubach
Sent: Wednesday, May 30, 2007 6:24 AM
To: [hidden email]
Subject: SAVE OUTFILE to the same filename

Hi All,

we have set up a syntax program that creates a dataset from two
different files. We would like to match a third one but we get the
following error message:

----- cut -----
SAVE
    OUTFILE = '...cut...\03_Countries\NZ\' +
           '10_Data_Analysis\02_Data\' +
           '23_50_00_85_DHL_GFW_CS_2_2007_NZ_matched.sav'
   /COMPRESSED .

>Warning # 5334.  Command name: SAVE
>The SAVE command has succeeded.  However, due to contention for the
>specified file, the data have been saved to a file with a different
name.

>Saved to ...cut...\02_Custo. (rest of filename is missing)
----- cut -----

The syntax run is as follows:

1. Step: Load Excel file no. 1 with customer information and do some
data transformations
2. Step: Save Excel file no. 1 with SAVE OUTFILE as an SAV file
3. Step: Load dataset file no. 2 with answers of respondents as SAV file
4. Step: Match file no. 1 to file no. 2 (as SAV)
5. Step: Save matched file with SAVE OUTFILE to file "xyz.sav"
6. Step: Load Excel file no. 3 with open-ended questions and do some
data transformations
7. Step: Save Excel file no. 3 with SAVE OUTFILE as an SAV file
8. Step: Load dataset "xyz.sav"
9. Step: Match file "xyz.sav" and file no. 3 (as SAV)
10. Step. Save matched file with SAVE OUTFILE to file 'xyz.sav'

In the 10th Step we get the above mentioned error message.

To me it looks like as if SPSS does not free the allocated file name if
a new file is loaded during single syntax run. In other syntax programs
we use different file names like "temp1.sav", "temp2.sav", "temp3.sav"
and so forth. But this time we need the process exactly as described
because we have set up a system of many depending programs that now need
to be extended.

SPSS is changing the file name to one that SPSS likes but we need
exactly the one we chose because other syntax programs refer to it.

Is there a way to tell SPSS that it should overwrite the old dataset
during a single SPSS syntax run?

Regards

Georg Maubach
Market Analyst
Reply | Threaded
Open this post in threaded view
|

Re: SAVE OUTFILE to the same filename

noah.ganter
In reply to this post by Georg Maubach
Try:

DATASET CLOSE $DATASET.

Put this before your SAVE OUTFILE= command. I was having this problem and realized that the new PASW type SPSS has created this whole 'layer' of 'datasets'. The $DATASET is the default dataset name SPSS is now giving to it's 'datasets'. The behavior of GET FILE, do something, SAVE OUTFILE not working in this way is very frustrating for A) power users and B) older SPSS users. It seems as though SPSS is trying to defeat one of the most common and basic actions in computer programming. But hey, this is a 'feature' to prevent you from overwriting your data (even if that is what you are telling the program to do).

I know SPSS is great for what it does but my sense is that IBM and the powers that be have let a few too many of the bugs go on while users suffer through 'workarounds' and being told the bug is actually a feature.

uggg...its not you....you are probably a power user for whom this behavior is just bizarre.
Reply | Threaded
Open this post in threaded view
|

Re: SAVE OUTFILE to the same filename

Art Kendall
However, saving to the same filename can be a very dangerous thing to do.
It is possible that you will no longer have the ability to go back and do it over right/better/more-clearly.
Unless you have take special precautions you would lose traceability.

Except in some simulation applications I doubt many power users would very often
get file A.
do something (presumably transfomations or something that changes the file)
save file A.

Jon, David, Bruce, Andy, Rich, ViAnn, Marta, Ryan, Rick, Eugen, Mike  what do you think?  Agree that this can often be the same thing as shooting your self in the foot?

If there are no changes to the file why would you bother saving it over itself.


Art Kendall
Social Research Consultants
On 7/26/2013 5:21 PM, noah.ganter [via SPSSX Discussion] wrote:
Try:

DATASET CLOSE $DATASET.

Put this before your SAVE OUTFILE= command. I was having this problem and realized that the new PASW type SPSS has created this whole 'layer' of 'datasets'. The $DATASET is the default dataset name SPSS is now giving to it's 'datasets'. The behavior of GET FILE, do something, SAVE OUTFILE not working in this way is very frustrating for A) power users and B) older SPSS users. It seems as though SPSS is trying to defeat one of the most common and basic actions in computer programming. But hey, this is a 'feature' to prevent you from overwriting your data (even if that is what you are telling the program to do).

I know SPSS is great for what it does but my sense is that IBM and the powers that be have let a few too many of the bugs go on while users suffer through 'workarounds' and being told the bug is actually a feature.

uggg...its not you....you are probably a power user for whom this behavior is just bizarre.


If you reply to this email, your message will be added to the discussion below:
http://spssx-discussion.1045642.n5.nabble.com/SAVE-OUTFILE-to-the-same-filename-tp1076068p5721393.html
To start a new topic under SPSSX Discussion, email [hidden email]
To unsubscribe from SPSSX Discussion, click here.
NAML

Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: SAVE OUTFILE to the same filename

noah.ganter
Just wanted a post a fix for those out there who are confused by this behavior.

Sure, for experienced SPSS users this behavior is probably not an issue and works well to prevent over writes. For other users, it can seem odd. I am returning to SPSS after years using SAS and R and I have been writing programs since I was 10.  I was frustrated by it and wanted to post a fix that worked for me and might help some one in need. I recognize this is an SPSS forum where SPSS is the tool people use.
Reply | Threaded
Open this post in threaded view
|

Re: SAVE OUTFILE to the same filename

Art Kendall

The warning was for the OP and people who look into the archives for info.

It is not just a question of SPSS.
In general in Data Processing or data analysis it is often dangerous to write over variables or files.
even in the late 60s files were given version numbersResources were much more scarce then.  But the new file

On many OSs the new file would not be given the new filename until it was completed and both the old and new file would be using resources while the new version was being written.


Art Kendall
Social Research Consultants
On 7/26/2013 6:13 PM, noah.ganter [via SPSSX Discussion] wrote:
Just wanted a post a fix for those out there who are confused by this behavior.

Sure, for experienced SPSS users this behavior is probably not an issue and works well to prevent over writes. For other users, it can seem odd. I am returning to SPSS after years using SAS and R and I have been writing programs since I was 10.  I was frustrated by it and wanted to post a fix that worked for me and might help some one in need. I recognize this is an SPSS forum where SPSS is the tool people use.


If you reply to this email, your message will be added to the discussion below:
http://spssx-discussion.1045642.n5.nabble.com/SAVE-OUTFILE-to-the-same-filename-tp1076068p5721396.html
To start a new topic under SPSSX Discussion, email [hidden email]
To unsubscribe from SPSSX Discussion, click here.
NAML

Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: SAVE OUTFILE to the same filename

Jon K Peck
In reply to this post by noah.ganter
If you use GET, no dataset name is assigned by default.  If you use the gui with default preferences, each data file opened gets a different dataset name.  If you have set your preferences to only open one dataset at a time, the name $DATASET is assigned to each file opened through the gui, which automatically causes any previous dataset of that name to be closed, because only one unnamed dataset can be open at a time.  This is strictly a gui convention, added because some users get confused by having multiple datasets open.

The job flow described in the original post - open Excel file, work on it, save as sav file, open another etc, and match these one by one could be improved by opening each file, assigning it a distinct dataset name, and leaving it open.  Then once all the files are ready, do the matches all at once in one pass, referring to the dataset names and save the resulting file.  DATASET ACTIVATE can be used to switch around among different datasets.

There is no intention to prevent saving a file over an input file of the same name.  As Art says, this may be undesirable, but depending on where the data come from and how the files are created and what the job is doing, it may well be possible to recreate the input, so resaving does not necessarily remove the option of rerunning that whole job stream.

If you open the same input twice, keeping both open via different dataset names, you get a file contention warning on the second one at open, and since the same file is open in two different windows, saving one will cause save to rename the output file.  Otherwise bad things could happen.




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




From:        "noah.ganter" <[hidden email]>
To:        [hidden email],
Date:        07/26/2013 04:06 PM
Subject:        Re: [SPSSX-L] SAVE OUTFILE to the same filename
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Try:

DATASET CLOSE $DATASET.

Put this before your SAVE OUTFILE= command. I was having this problem and
realized that the new PASW type SPSS has created this whole 'layer' of
'datasets'. The $DATASET is the default dataset name SPSS is now giving to
it's 'datasets'. The behavior of GET FILE, do something, SAVE OUTFILE not
working in this way is very frustrating for A) power users and B) older SPSS
users. It seems as though SPSS is trying to defeat one of the most common
and basic actions in computer programming. But hey, this is a 'feature' to
prevent you from overwriting your data (even if that is what you are telling
the program to do).

I know SPSS is great for what it does but my sense is that IBM and the
powers that be have let a few too many of the bugs go on while users suffer
through 'workarounds' and being told the bug is actually a feature.

uggg...its not you....you are probably a power user for whom this behavior
is just bizarre.



--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/SAVE-OUTFILE-to-the-same-filename-tp1076068p5721393.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: SAVE OUTFILE to the same filename

Richard Ristow
In reply to this post by Art Kendall
At 05:38 PM 7/26/2013, Art Kendall wrote:

>Saving to the same filename can be a very dangerous thing to do. It
>is possible that you will no longer have the ability to go back and
>do it over right/better/more-clearly. Unless you have take special
>precautions you would lose traceability.
>
>I doubt many power users would very often
>get file A.
>do something (presumably transformations or something that changes the file)
>save file A.
>
>Jon *et al*, what do you think?

I've tried to think whether I would ever do this, and doubt that I
would. As physical preservationists say, "Never do anything you can't
undo". Or, anything that obscures what you've done.

In a project of any complexity, I usually write the transformation
code in stages, each reading one or more existing files and writing
one new one; usually, I give each SPSS program the same name as the
.SAV file it creates. That means every step in the path can be
checked, and all or any part of it can be reproduced.

(It also means that if the whole path needs to be reproduced, for
example because the external source has been updated, a set of
programs has to be run in a specific order, and that takes care and
documentation. I wonder if somebody'd like to write an SPSS 'MAKE'
command in Python?)

=====================
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: SAVE OUTFILE to the same filename

Rich Ulrich
I agree that saving to the old name is a dangerous thing, so I did not
mind the awkwardness when I came to figure out a way to do it in SPSS. 
It seemed like a good idea to keep it awkward.

Before there was ample disk space, keeping down the number of
versions of a file mattered more than it does now.  (That was always
true while I worked on a mainframe computer, which is what I
preferred up to about 2004.)   In olden days, the execution times
mattered, too. 

In olden days, I might ADD new variables to a file, or perhaps
make a very simple correction, and use the same name.  But it was
important that the new file would perform exactly like the old version
if it was run on any other syntax - no DROPped variables, or swapping
of values.

Keeping documentation accessible always matters.  When execution
time became irrelevant,  I learned to re-run the original file-creating
stuff after adding or correcting whatever needed to be added. 

--
Rich Ulrich

> Date: Sat, 3 Aug 2013 12:42:28 -0400

> From: [hidden email]
> Subject: Re: SAVE OUTFILE to the same filename
> To: [hidden email]
>
> At 05:38 PM 7/26/2013, Art Kendall wrote:
>
> >Saving to the same filename can be a very dangerous thing to do. It
> >is possible that you will no longer have the ability to go back and
> >do it over right/better/more-clearly. Unless you have take special
> >precautions you would lose traceability.
> >
> >I doubt many power users would very often
> >get file A.
> >do something (presumably transformations or something that changes the file)
> >save file A.
> >
> >Jon *et al*, what do you think?
>
> I've tried to think whether I would ever do this, and doubt that I
> would. As physical preservationists say, "Never do anything you can't
> undo". Or, anything that obscures what you've done.
>
> In a project of any complexity, I usually write the transformation
> code in stages, each reading one or more existing files and writing
> one new one; usually, I give each SPSS program the same name as the
> .SAV file it creates. That means every step in the path can be
> checked, and all or any part of it can be reproduced.
>
> (It also means that if the whole path needs to be reproduced, for
> example because the external source has been updated, a set of
> programs has to be run in a specific order, and that takes care and
> documentation. I wonder if somebody'd like to write an SPSS 'MAKE'
> command in Python?)
>
> =====================
>...
Reply | Threaded
Open this post in threaded view
|

Re: SAVE OUTFILE to the same filename

kwame woei
I find the inability to save under the same file name very annoying. I  have a database with 400.000 cases from which I pull the variables needed and then select the cases which I need. Because SPSS becomes very slow if you delete a lot of cases, I need to save the file. Because of the inability to "resave" the file I have to come up with various file names. 

I have a data source which I don't alter. I program everything in Syntax files so I can retrace my steps. If I instruct SPSS to save over an existing file SPSS should do that. My program, my choice. 

Ah... Wishfull thinking...

Op 3 aug. 2013 om 19:50 heeft "Rich Ulrich" <[hidden email]> het volgende geschreven:

I agree that saving to the old name is a dangerous thing, so I did not
mind the awkwardness when I came to figure out a way to do it in SPSS. 
It seemed like a good idea to keep it awkward.

Before there was ample disk space, keeping down the number of
versions of a file mattered more than it does now.  (That was always
true while I worked on a mainframe computer, which is what I
preferred up to about 2004.)   In olden days, the execution times
mattered, too. 

In olden days, I might ADD new variables to a file, or perhaps
make a very simple correction, and use the same name.  But it was
important that the new file would perform exactly like the old version
if it was run on any other syntax - no DROPped variables, or swapping
of values.

Keeping documentation accessible always matters.  When execution
time became irrelevant,  I learned to re-run the original file-creating
stuff after adding or correcting whatever needed to be added. 

--
Rich Ulrich

> Date: Sat, 3 Aug 2013 12:42:28 -0400

> From: [hidden email]
> Subject: Re: SAVE OUTFILE to the same filename
> To: [hidden email]
>
> At 05:38 PM 7/26/2013, Art Kendall wrote:
>
> >Saving to the same filename can be a very dangerous thing to do. It
> >is possible that you will no longer have the ability to go back and
> >do it over right/better/more-clearly. Unless you have take special
> >precautions you would lose traceability.
> >
> >I doubt many power users would very often
> >get file A.
> >do something (presumably transformations or something that changes the file)
> >save file A.
> >
> >Jon *et al*, what do you think?
>
> I've tried to think whether I would ever do this, and doubt that I
> would. As physical preservationists say, "Never do anything you can't
> undo". Or, anything that obscures what you've done.
>
> In a project of any complexity, I usually write the transformation
> code in stages, each reading one or more existing files and writing
> one new one; usually, I give each SPSS program the same name as the
> .SAV file it creates. That means every step in the path can be
> checked, and all or any part of it can be reproduced.
>
> (It also means that if the whole path needs to be reproduced, for
> example because the external source has been updated, a set of
> programs has to be run in a specific order, and that takes care and
> documentation. I wonder if somebody'd like to write an SPSS 'MAKE'
> command in Python?)
>
> =====================
>...
Reply | Threaded
Open this post in threaded view
|

Re: SAVE OUTFILE to the same filename

Jon K Peck
I don't know what you are doing that causes this problem.  You can open a file with a GET command and write back to it with a SAVE command using the same name without getting a contention action.


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




From:        kwame woei <[hidden email]>
To:        [hidden email],
Date:        08/03/2013 03:25 PM
Subject:        Re: [SPSSX-L] SAVE OUTFILE to the same filename
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




I find the inability to save under the same file name very annoying. I  have a database with 400.000 cases from which I pull the variables needed and then select the cases which I need. Because SPSS becomes very slow if you delete a lot of cases, I need to save the file. Because of the inability to "resave" the file I have to come up with various file names.

I have a data source which I don't alter. I program everything in Syntax files so I can retrace my steps. If I instruct SPSS to save over an existing file SPSS should do that. My program, my choice.

Ah... Wishfull thinking...

Op 3 aug. 2013 om 19:50 heeft "Rich Ulrich" <
[hidden email]> het volgende geschreven:

I agree that saving to the old name is a dangerous thing, so I did not
mind the awkwardness when I came to figure out a way to do it in SPSS.  
It seemed like a good idea to keep it awkward.

Before there was ample disk space, keeping down the number of
versions of a file mattered more than it does now.  (That was always
true while I worked on a mainframe computer, which is what I
preferred up to about 2004.)   In olden days, the execution times
mattered, too.  

In olden days, I might ADD new variables to a file, or perhaps
make a very simple correction, and use the same name.  But it was
important that the new file would perform exactly like the old version
if it was run on any other syntax - no DROPped variables, or swapping
of values.

Keeping documentation accessible always matters.  When execution
time became irrelevant,  I learned to re-run the original file-creating
stuff after adding or correcting whatever needed to be added.  

--
Rich Ulrich

> Date: Sat, 3 Aug 2013 12:42:28 -0400
> From:
wrristow@...
> Subject: Re: SAVE OUTFILE to the same filename
> To:
[hidden email]
>
> At 05:38 PM 7/26/2013, Art Kendall wrote:
>
> >Saving to the same filename can be a very dangerous thing to do. It
> >is possible that you will no longer have the ability to go back and
> >do it over right/better/more-clearly. Unless you have take special
> >precautions you would lose traceability.
> >
> >I doubt many power users would very often
> >get file A.
> >do something (presumably transformations or something that changes the file)
> >save file A.
> >
> >Jon *et al*, what do you think?
>
> I've tried to think whether I would ever do this, and doubt that I
> would. As physical preservationists say, "Never do anything you can't
> undo". Or, anything that obscures what you've done.
>
> In a project of any complexity, I usually write the transformation
> code in stages, each reading one or more existing files and writing
> one new one; usually, I give each SPSS program the same name as the
> .SAV file it creates. That means every step in the path can be
> checked, and all or any part of it can be reproduced.
>
> (It also means that if the whole path needs to be reproduced, for
> example because the external source has been updated, a set of
> programs has to be run in a specific order, and that takes care and
> documentation. I wonder if somebody'd like to write an SPSS 'MAKE'
> command in Python?)
>
> =====================
>...