Sentry Page Protection
Variable Attributes [5-17]
Attribute #3: Variable Type (Numeric)
There are only 2 types of variable in SAS:
- Numeric
- Character
Numeric Variable
Numeric variable is used when you have numeric data such as:
- Age
- Dollar Amount
- Date
The 3 variables from the data set are all numeric variables.
Note: the results above are from Proc Contents.
No text is allowed
Numeric variable does not allow any character or text values.
Why?
You often need to compute summary statistics such as mean, standard deviation or median on numeric variables.
Having a character value (such as "unknown", "abc") in a numeric variable will prevent the statistics to be computed.
Numeric variable does not allow any character or text values.
Why?
You often need to compute summary statistics such as mean, standard deviation or median on numeric variables.
Having a character value (such as "unknown", "abc") in a numeric variable will prevent the statistics to be computed.
Missing Value
You can't avoid having missing value(s) when dealing with data.
When there is a missing value, the numeric variable will show a dot (.) in the data set.
Example
Important Note
Missing value means that there is no information available in that particular field.
It does NOT equal zero (0).
A Note on Date Values
Handling the date values in SAS requires special attention. This will be explained in details later this module.
Summary of Numeric Variable
- Numeric variable is used when working with numeric values such as age, dollar amount or date
- No text or character value is allowed in a numeric variable
- Missing value is represented by a dot in a numeric variable
- Handling the date values (numeric value) requires special attention. This will be explained in later sessions of this module.
Exercise
Which of the following values are best kept under a numeric variable?
(a) 1234
(b) $12,345
(c) 2015-01-01
(d) .
(e) all of the above
Which of the following values are best kept under a numeric variable?
(a) 1234
(b) $12,345
(c) 2015-01-01
(d) .
(e) all of the above
Need some help?
HINT:
Any values that can be used in any summary statistics calculation should be kept under a numeric variable.
SOLUTION:
(e).
Please note that (b) and (c) include character values (i.e. dollar sign ($), comma (,) and dash (-)). Handling this kind of data will be explained in later sessions.
Fill out my online form.