DUPLICATE directive

Forms new data structures with attributes taken from an existing structure.

Options

ATTRIBUTES = string tokens Which attributes to duplicate (all, nvalues, values, nlevels, levels, labels (of factors or pointers), extra, decimals, characters, rows, columns, classification, margins, suffixes, minimum, maximum, restriction, referencelevel); default all
REDEFINE = string token Whether or not to delete the attributes of the new structures beforehand so that their types can be redefined (yes, no); default no

Parameters

OLDSTRUCTURE = identifiers Data structures to provide attributes for the new structures
NEWSTRUCTURE = identifiers Identifiers of the new structures
VALUES = identifiers Values for each new structure
DECIMALS = scalars Number of decimals for printing numerical structures
CHARACTERS = scalars Number of characters for printing texts or labels of a factor
EXTRA = texts Extra text associated with each identifier
MINIMUM = scalars Minimum value for numerical structures
MAXIMUM = scalars Maximum value for numerical structures

Description

The DUPLICATE directive lets you define new data structures with attributes like those of existing structures. The attributes to be duplicated are defined by the ATTRIBUTES option. The structures from which the attributes are to be taken are specified by the OLDSTRUCTURES parameter, while the structures that are to be defined are specified by the NEWSTRUCTURES parameter. The other parameters allow some of the more important attributes to be reset at the same time. For example, here the factor Species2 takes its levels (and thus its number of levels) from the factor Species1. However, the labels are not transferred, and other values are defined using the VALUES parameter.

FACTOR [LEVELS=!(0,1); LABELS=!T(absent,present);\

  VALUES=0,1,1,0,0,0,1] Species1

DUPLICATE [ATTRIBUTES=levels] Species1;\

  NEWSTRUCTURE=Species2; VALUES=!(1,0,1,1,0,1,0)

You can set option REDEFINE=yes, to allow DUPLICATE to change the type of any pre-defined new structure, if necessary, to have the same type as the corresponding old structure. Otherwise, DUPLICATE will report a fault if the new structure has previously been defined to have a different type.

Options: ATTRIBUTES, REDEFINE.

Parameters: OLDSTRUCTURE, NEWSTRUCTURE, VALUES, DECIMALS, CHARACTERS, EXTRA, MINIMUM, MAXIMUM.

See also

Directive: RENAME.

Procedure: PDUPLICATE.

Commands for: Data structures.

Updated on March 8, 2019

Was this article helpful?