Overview (DATAFILE ATTRIBUTE command)

DATAFILE ATTRIBUTE provides the ability for you to define your own data file attributes and assign attribute values to the active dataset.

  • User-defined data file attributes are saved with the data file in the data dictionary.
  • The DATAFILE ATTRIBUTE command takes effect immediately, updating the data dictionary without requiring a data pass.
  • You can display a list of data file and variable attributes with DISPLAY ATTRIBUTES. See the topic DISPLAY for more information.

Basic Specification

The basic specification is:

  • ATTRIBUTE keyword followed by an equals sign (=) and one or more attribute names that follow variable naming rules, with each attribute name followed by a quoted attribute value, enclosed in parentheses.

or

  • DELETE keyword followed by an equals sign (=) and a list of defined attribute names or attribute arrays.

Syntax Rules

  • The keywords ATTRIBUTE and DELETE must each be followed by an equals sign (=).
  • Each ATTRIBUTE keyword must be followed by a name that follows variable naming rules and a single, quoted attribute value, enclosed in parentheses. See the topic Variable Names for more information.
  • Attribute names that begin with @ are not displayed by DISPLAY DICTIONARY or DISPLAY ATTRIBUTES. They can only be displayed with DISPLAY @ATTRIBUTES.
  • Attribute names that begin with a dollar sign ($) are reserved for internal use.
  • All attribute values must be quoted (single or double quotes), even if the values are numbers.
  • Attribute values can be up to 32,767 bytes in length.

Example

DATAFILE ATTRIBUTE 
  ATTRIBUTE=OriginalVersion ('1')
            CreationDate('10/28/2004')
            RevisionDate('10/29/2004').

Attribute Arrays

If you append an integer enclosed in square brackets to the end of an attribute name, the attribute is interpreted as an array of attributes. For example:

DATAFILE ATTRIBUTE
  ATTRIBUTE=FileAttribute[99]('not quite 100').

will create 99 attributes--FileAttribute[01] through FileAttribute[99]--and will assign the value "not quite 100" to the last one.

  • Array subscripts (the value enclosed in square brackets) must be integers greater than 0. (Array subscript numbering starts with 1, not 0.)
  • If the root name of an attribute array is the same as an existing attribute name, the attribute array replaces the existing attribute. If no value is assigned to the first element in the array (subscript [1]), the original attribute value is used for that element value.

With the DELETE keyword, the following rules apply to attribute arrays:

  • If you specify DELETE followed by an array root name and no value in square brackets, all attributes in the array are deleted.
  • If you specify DELETE with an array name followed by an integer value in square brackets, the specified array element is deleted and the integer values for all subsequent attributes in the array (in numeric order) are changed to reflect the new order of array elements.

Example

DATAFILE ATTRIBUTE    
  ATTRIBUTE=RevisionDate('10/29/2004').
 DATAFILE ATTRIBUTE
   ATTRIBUTE=RevisionDate[2] ('10/21/2005').
DATAFILE ATTRIBUTE
  DELETE=RevisionDate[1]. 
DATAFILE ATTRIBUTE 
  DELETE=RevisionDate.
  • The first DATAFILE ATTRIBUTE command creates the attribute RevisionDate with a value of 10/29/2004.
  • The second DATAFILE ATTRIBUTE command creates an array attribute named RevisionDate, which replaces the original attribute of the same name. Two array elements are created: RevisionDate[1] retains the original value of RevisionDate, and RevisionDate[2] has a value of 10/21/2005.
  • The third DATAFILE ATTRIBUTE command deletes RevisionDate[1], and the array element formerly known as RevisionDate[2] becomes the new RevisionDate[1] (with a value of 10/21/2005).
  • The last DATAFILE ATTRIBUTE command deletes all attributes in the RevisionDate array, since it specifies the array root name without an integer value in brackets.