SPSS Add Files

The ADD FILES command adds the rows of an multiple datasets.


Usage

add files
  /file=fiscalquarter1
  /file=fiscalquarter2
  /file=fiscalquarter3
  /file=fiscalquarter4.

If a variable is present in more than one dataset, metadata is taken from the first dataset with any (i.e. variable label, value labels, or missing values) metadata set.

File

Each /FILE subcommand takes one of:

If the active dataset is included in a join and referenced by a star (*), that dataset will be modified in-place by the join.

If the active dataset is included in a join and referenced by name, the final dataset will retain the name.

If the active dataset is not included, the final dataset is unnamed and becomes the active dataset.

Rename

The /RENAME subcommand applies renames to the /FILE subcommand preceding it.

These renames take place before the datasets are combined.

By, First, and Last

The /BY subcommand causes the final dataset to be sorted by a key variable. Each dataset must be presorted by the key variables.

The /FIRST and /LAST subcommands append flag variables that mark the first and last matches by the key variables.

Together, these options can be used to mark the sequence of cases within a group.

add files
 /file=*
 /by id
 /first=PrimaryFirst
 /last=PrimaryLast.
do if PrimaryFirst=1.
  compute MatchSequence = 1 - PrimaryLast.
else.
  compute MatchSequence = MatchSequence + 1.
end if.
leave MatchSequence.

Keep and Drop

The /KEEP and /DROP subcommands specify a list of variables to keep or drop from the final dataset.

Any variable created by a /IN, /FIRST, or /LAST subcommand cannot be dropped.


Data Model

The ADD FILES command reads all datasets and data files named on /FILE subcommands.

Execution of the ADD FILES command is deferred until the active dataset is read, or until one of the EXECUTE, SAVE, or SORT CASES commands are used.

The ADD FILES command recognizes FILTER status and preserves it, although filtered cases are included in the final dataset.

The ADD FILES command deactivates WEIGHT status.


See also

PSPP manual for ADD FILES


CategoryRicottone

SPSS/AddFiles (last edited 2023-06-12 00:59:30 by DominicRicottone)