• Articles
  • Tutorials
  • Interview Questions

Variable Attributes in SAS

What are SAS Variables?

In addition to general information about the dataset, the descriptor portion contains information about the attributes of each variable in the data set. The attribute information includes the variables: Name, Type, Length, format, informat and label.

Name:

It identifies a variable that conforms to SAS naming rules. SAS naming Rule same as SAS data set.

  • 1-32 characters long
  • Must begin with letter or underscore
  • Can continue with any combination of numbers, letters or underscore

Type:

It identify variable as numeric or character. Character variables can contain any values such as letters; number and special characters can be of 1 to 32,767 characters long. Numeric variable can contain only numeric values.

Become a Data Science Architect

Length:

It refers number of bytes used to store each of the variables value in a SAS data set. LENGTH statement can be used to set the length of both numeric and character variable.
For numeric variable, default length is 8. If you modify using LENGTH statement it affect the length of numeric values only in output dataset; during processing all numeric length is 8.

Format:

A Format is an instruction that SAS uses to write data values. Format is used to control the written appearance of data values, or in some cases, to group data values together for analysis.
SAS software offers a variety of character, numeric, and date and time formats. Format scan be created and stored using FORMAT statement.
Can permanently assign a format to a variable in a SAS data set, or can temporarily specify a format in a PROC step to determine the way the data values appear in the output
Default format is BEST12. For numeric value
$w. for a character variable

Informat:

Used to read data values in certain formats into standard SAS values. It determines how data values are read into a SAS data set. Informats are used to read numeric values that contain letters or other special characters
Default informat is w.d for numeric value
$w. for a character variable

Label:

A variable can have a label consisting of descriptive text up to 256 characters long
By default, many reports identify variables by their names, to display more descriptive information about the variable assign a label to that variable.

Course Schedule

Name Date Details
Big Data Course 14 Dec 2024(Sat-Sun) Weekend Batch View Details
21 Dec 2024(Sat-Sun) Weekend Batch
28 Dec 2024(Sat-Sun) Weekend Batch

About the Author

Technical Research Analyst - Big Data Engineering

Abhijit is a Technical Research Analyst specialising in Big Data and Azure Data Engineering. He has 4+ years of experience in the Big data domain and provides consultancy services to several Fortune 500 companies. His expertise includes breaking down highly technical concepts into easy-to-understand content.