Developer Documentation Library > Data Model > Available DSCs > SPSS Statistics SAV DSC > Updating an SPSS Statistics .sav file
 
Updating an SPSS Statistics .sav file
The SPSS Statistics SAV DSC can update the case data in an existing IBM SPSS Statistics .sav file. This capability is typically used to add weights (see Working with the Weight component) to a .sav file, although it is also utilized when you use UNICOM Intelligence Professional to write interview response data to a .sav file for testing purposes.
You can also use the update capability to perform some simple cleaning of a .sav file by executing an SQL query that contains an UPDATE statement. However, you are generally advised to carry out data cleaning using a Data Management script, as that method keeps a copy of the original "dirty" data. For more information, see Data cleaning.
The SPSS Statistics SAV DSC cannot be used to add or remove columns (variables) in an existing IBM SPSS Statistics .sav file. You can only use the ALTER TABLE statement to modify a table definition when a .sav file is first created, and the DSC only supports the addition of columns (not the removal of columns).
How the SPSS Statistics SAV DSC updates a .sav file
The SPSS Statistics SAV DSC uses a software component that is part of the IBM SPSS Statistics statistical analysis program to read and write .sav files. However, that software component does not support the updating of existing .sav files. Instead, the SPSS Statistics SAV DSC creates a temporary file called a "shadow" file (with a file extension of .sav.new) to which it writes all updated and unchanged records from the existing (input) .sav file. At the end of the updating process, both files are closed and the existing .sav file is replaced by the shadow file.
Troubleshooting
The process that the SPSS Statistics SAV DSC uses to update .sav files is generally invisible to the user. However, problems might occur if the SPSS Statistics SAV DSC can not create the temporary shadow (.sav.new) file or if it can not replace the existing .sav file with the shadow file. The error message displayed in these situations normally provides more information about the problem, but if the cause of the problem is still not clear, check that:
There is enough free disk space in the folder that the existing .sav file is in to create the temporary shadow file; it will be the same size as the existing .sav file plus any additional space for the updated values.
You have the correct permissions to delete the existing .sav file
The existing .sav file is not open in another application (such as the IBM SPSS Statistics program).
Sample script
The DDL includes a data management script called SavWeighting.dms, which demonstrates how to use the update capability of the SPSS Statistics SAV DSC to add weights to a .sav file. For more information, see Sample DMS files.
See also
SPSS Statistics SAV DSC