Chapter Contents |
Previous |
Next |
ATTRIB |
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) ; |
Tip: | List the variables in any form that SAS allows. |
Tip: | The format can be either a standard SAS format or a format that is defined with the FORMAT procedure. |
Tip: | The informat can be either a standard SAS informat or an informat that is defined with the FORMAT procedure. |
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. |
Details |
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.
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
Comparisons |
Examples |
Here are examples of ATTRIB statements that contain
attrib cost length=4;
attrib saleday informat=mmddyy. format=worddate.;
attrib x y length=$4 label='TEST VARIABLE';
attrib x length=$4 label='TEST VARIABLE' y length=$2 label='RESPONSE';
attrib month1-month12 label='MONTHLY SALES';
See Also |
Statements:
|
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.