In SAS, there are 6 attributes that define each of the SAS variables:
To view the variable attributes, simply click the variable on the variable list on the left of the data set. The variable attributes will be displayed below the variable list.
Variable Attribute #1: Variable Name
Variable name is used to reference the variable in your program. It cannot be more than 32 characters and it cannot contain any special symbol such as $ or #.
Variable Attribute #2: Variable Label
Variable label is the description of the variable. You can add up to 256 characters to the variable label.
Variable Attribute #3: Variable Length
Variable length is the number of bytes assigned to the variable. Character variable with insufficient length will get truncated.
Variable Attribute #4: Variable Type
In SAS, there are only two types of variables: numeric or character. Numeric variables store numeric values such as age, amount, date and time. Character variables store character values such as comments and descriptions.
Variable Attribute #5: Variable Format
Variable format is used to change the display of the variable values. For example, the numeric value 10000 can be displayed as $10,000 with a proper format.
Variable Attribute #6: Variable Informat
Variable informat is used mostly when importing data or converting variable from character to numeric.
Further resources to learn more about variable attributes:
Proc SQL is an advanced programming step commonly used when working with data in relational database. It can often achieve the same results as the traditional data step but with higher efficiency. Let's take a look at some examples.
Example 1: Retrieving Data from Data Set
Proc SQL allows you to retrieve data from a data set while subsetting and sorting the data set within the same step.
Example 2: Summarizing Data
Proc SQL also allows you to summarize data using the built-in summary functions.
Example 3: Creating Table (Data Set)
The code above creates a data set BIGFISH that contains only the fishes that are more than 1000 lbs.