Size: 1061
Comment:
|
← Revision 8 as of 2024-01-02 17:07:57 ⇥
Size: 1500
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
## page was renamed from SPSS/UpdateFile = SPSS Update File = |
= SPSS Update = The '''`UPDATE`''' command overwrites values in a dataset with non-missing values from another dataset. |
Line 12: | Line 13: |
To overwrite values in a master file with non-null values in transaction files, try: |
|
Line 15: | Line 14: |
update file=LEFT /file=TRANSACTION /by KEYVARLIST. |
update file=foo /file=bar /by KEYVARS. |
Line 20: | Line 19: |
The final dataset contains all rows and variables from all datasets. Rows and variables originating from a transaction file are appended. | The '''master file''' is modified in-place. Rows and columns originating from a '''transaction file''' are appended. The key variables must be defined with the same format in each dataset. Cases must be uniquely identified by the key variables in each dataset. The requirement for same format includes a requirement for same length of string variables, except in PSPP version 2.0 or later. Each dataset must be presorted by the key variables. |
Line 26: | Line 31: |
Each `/FILE` subcommand takes one of: | Each '''`/FILE`''' subcommand takes one of: |
Line 30: | Line 35: |
* a filename or file handle | * a filename or [[SPSS/FileHandle|file handle]] |
Line 32: | Line 37: |
The master dataset is always modified in-place by the update. | ---- |
Line 36: | Line 41: |
=== By === | == Data Model == |
Line 38: | Line 43: |
The /BY subcommand specified how cases can be uniquely identified. The `KEYVARLIST` can be one ore more variables. | The `UPDATE` command reads all datasets and data files named on `/FILE` subcommands. |
Line 40: | Line 45: |
The folowing are required of key variables: | Execution of the `UPDATE` command is deferred until the active dataset is read, or until one of the [[SPSS/Execute|EXECUTE]], [[SPSS/FileIO|SAVE]], or [[SPSS/SortCases|SORT CASES]] commands are used. |
Line 42: | Line 47: |
* They must be defined and have the same format in each file (including length for string variables) * They must uniquely identify a case in each file * Each file must be pre-sorted by them |
The `UPDATE` command recognizes [[SPSS/Filter|FILTER]] status and preserves it, although filtered cases are included in the final dataset. ---- == See also == [[https://www.gnu.org/software/pspp/manual/html_node/UPDATE.html|PSPP manual for UPDATE]] |
SPSS Update
The UPDATE command overwrites values in a dataset with non-missing values from another dataset.
Contents
Usage
update file=foo /file=bar /by KEYVARS.
The master file is modified in-place. Rows and columns originating from a transaction file are appended.
The key variables must be defined with the same format in each dataset. Cases must be uniquely identified by the key variables in each dataset.
The requirement for same format includes a requirement for same length of string variables, except in PSPP version 2.0 or later.
Each dataset must be presorted by the key variables.
File
Each /FILE subcommand takes one of:
a star (*) indicating the active data set
- the name of a data set
a filename or file handle
Data Model
The UPDATE command reads all datasets and data files named on /FILE subcommands.
Execution of the UPDATE command is deferred until the active dataset is read, or until one of the EXECUTE, SAVE, or SORT CASES commands are used.
The UPDATE command recognizes FILTER status and preserves it, although filtered cases are included in the final dataset.