Overview (DATASET DECLARE command)

The DATASET commands (DATASET NAME, DATASET ACTIVATE, DATASET DECLARE, DATASET COPY, DATASET CLOSE) provide the ability to have multiple data sources open at the same time and control which open data source is active at any point in the session. Using defined dataset names, you can then:

  • Merge data (for example, MATCH FILES, ADD FILES, UPDATE) from multiple different source types (for example, text data, database, spreadsheet) without saving each one as an external IBM® SPSS® Statistics data file first.
  • Create new datasets that are subsets of open data sources (for example, males in one subset, females in another, people under a certain age in another, or original data in one set and transformed/computed values in another subset).
  • Copy and paste variables, cases, and/or variable properties between two or more open data sources in the Data Editor.

The DATASET DECLARE command creates a new dataset name that is not associated with any open dataset. It can become associated with a dataset if it is used in a command that writes IBM SPSS Statistics data files. This is particularly useful if you need to create temporary IBM SPSS Statistics data files as an intermediate step in a program.

Basic Specification

The basic specification for DATASET DECLARE is the command name followed by a new dataset name that conforms to variable naming rules. See the topic Variable Names for more information.

WINDOW Keyword

The WINDOW keyword controls the state of the Data Editor window associated with the dataset.

MINIMIZED. The Data Editor window associated with the new dataset is opened in a minimized state. This is the default.

HIDDEN. The Data Editor window associated with the new dataset is not displayed.

FRONT. The Data Editor window containing the dataset is brought to the front and the dataset becomes the active dataset for dialog boxes.

Example

DATASET DECLARE corrmatrix.
REGRESSION 
  /DEPENDENT=var1 
  /METHOD=ENTER= var2 to var10
  /OUTFILE=CORB(corrmatrix).
  • The DATASET DECLARE command creates a new dataset name, corrmatrix, that is initially not assigned to any data source.
  • The REGRESSION command writes a correlation matrix to a data file.
  • Instead of specifying an external data file, the OUTFILE subcommand specifies the dataset name corrmatrix, which is now available for subsequent use in the session. If not explicitly saved (for example, with the SAVE command), this dataset will be automatically deleted at the end of the session.