Chapter Contents

Previous

Next
ATTRIB

ATTRIB



Associates a format, informat, label, and/or length with one or more variables

Valid: in a DATA step
Category: Information
Type: Declarative


Syntax
Arguments
Details
The Basics
How SAS Treats Variables when You Assign Informats with the INFORMAT= Option on the ATTRIB Statement
Comparisons
Examples
See Also

Syntax

ATTRIB variable-list(s) attribute-list(s) ;

Arguments

variable-list
names the variables that you want to associate with the attributes.
Tip: List the variables in any form that SAS allows.

attribute-list
specifies one or more attributes to assign to variable-list. Specify one or more of these attributes in the ATTRIB statement:

FORMAT=format
associates a format with variables in variable-list.
Tip: The format can be either a standard SAS format or a format that is defined with the FORMAT procedure.

INFORMAT=informat
associates an informat with variables in variable-list.
Tip: The informat can be either a standard SAS informat or an informat that is defined with the FORMAT procedure.

LABEL='label'
associates a label with variables in variable-list.

LENGTH=<$>length
specifies the length of variables in variable-list.
Requirement: Put a dollar sign ($) in front of the length of character variables.
Tip: Use the ATTRIB statement before the SET statement to change the length of variables in an output data set when you use an existing data set as input.
Range: For character variables, the range is 1 to 32,767 for all operating environments.

Operating Environment Information:   For numeric variables, the minimum length you can specify with the LENGTH= specification is 2 in some operating environments and 3 in others.  [cautionend]


Details

The Basics

Using the ATTRIB statement in the DATA step permanently associates attributes with variables by changing the descriptor information of the SAS data set that contains the variables.

You can use ATTRIB in a PROC step, but the rules are different.

How SAS Treats Variables when You Assign Informats with the INFORMAT= Option on the ATTRIB Statement

Informats that are associated with variables by using the INFORMAT= option on the ATTRIB statement behave like informats that are used with modified list input. SAS reads the variables by using the scanning feature of list input, but applies the informat. In modified list input, SAS

If you have coded the INPUT statement to use another style of input, such as formatted input or column input, that style of input is not used when you use the INFORMAT= option on the ATTRIB statement.


Comparisons

You can use either an ATTRIB statement or an individual attribute statement such as FORMAT, INFORMAT, LABEL, and LENGTH to change an attribute that is associated with a variable.


Examples

Here are examples of ATTRIB statements that contain


See Also

Statements:

FORMAT
INFORMAT
LABEL
LENGTH


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.