Chapter Contents |
Previous |
Next |
A SAS variable has the attributes that are listed in the following table:
Variable Attribute | Possible Values | Default Value | |
---|---|---|---|
Name | Any valid SAS name. See Rules for Words and Names. | None | |
Type ¹ | Numeric, character | Numeric | |
Length ¹ | 2 to 8 bytes ² 1 to 32,767 bytes for character |
8 bytes for numeric, character | |
Format | See Formats. | BEST12. for numeric, $w. for character | |
Informat | See Informats. | w.d for numeric, $w.for character | |
Label | Up to 256 characters | None | |
Position in observation | 1- n | NA | |
Index type | NONE, SIMPLE, COMPOSITE, or BOTH. | NA | |
1If not explicitly defined, a variable's type and length
are implicitly defined by its first occurrence in a DATA step.
2The minimum length is 2 bytes in some operating environments, 3 in others. See the SAS documentation for your operating environment. |
The names _N_, _ERROR_, _FILE_, _INFILE_, _MSG_, _IORC_, and _CMD_ are reserved for the variables that are generated automatically for a DATA step. Note that SAS products use variable names that start and end with an underscore; it is recommended that you do not use names that start and end with an underscore in your own applications. See Automatic Variables for more information.
To determine the value of this attribute, use the VNAME or VARNAME function.
Note: The rules for variable names that are described
in this section apply when the VALIDVARNAME= system option is set to VALIDVARNAME=
V7, the default setting. Other rules apply when this option is set differently.
See Rules for Words and Names
for more information.
To determine the value of this attribute, use the VTYPE or VARTYPE function.
In an INPUT statement, you can assign a length other than the default to character variables. You can also assign a length to a variable in the ATTRIB statement. A variable that appears for the first time on the left side of an assignment statement has the same length as the expression on the right side of the assignment statement.
To determine the value of this attribute, use the VLENGTH or VARLEN function.
To determine the value of this attribute, use the VFORMAT or VARFMT function.
To determine the value of this attribute, use the VINFORMAT or VARINFMT function.
To determine the value of this attribute, use the VLABEL or VARLABEL function.
var rent--phone;See SAS Variable Lists for more information.
The positions of variables in a SAS data set affect the order in which they appear in the output of SAS procedures, unless you control the order within your program, for example, with a VAR statement.
To determine the value of this attribute, use the VARNUM function.
To determine the value of this attribute, use the OUT= option with the CONTENTS procedure to create an output data set. The IDXUSAGE variable in the output data set contains one of the following values for each variable:
Value | Definition | |
---|---|---|
NONE | The variable is not indexed. | |
SIMPLE | The variable is part of a simple index. | |
COMPOSITE | The variable is part of one or more composite indexes. | |
BOTH | The variable is part of both simple and composite indexes. |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.