Sentry Page Protection
Variable Attributes [15-17]
Summary of Variable Formats
Variable Format is one of the most challenging concepts in SAS.
If you don't find it that difficult to understand, congratulation. The rest of the SAS training should be just a piece of cake for you.
Let's have a summary of variable format before we continue:
If you don't find it that difficult to understand, congratulation. The rest of the SAS training should be just a piece of cake for you.
Let's have a summary of variable format before we continue:
- Variable Format is commonly used on numeric variables. It allows you to display the data differently than the actual values stored in SAS.
- The W.D format allows you to control how many decimal places to display.
W=Width and D=Decimal Places - The Dollar and Comma formats allow you to display the dollar amount properly with the comma separator and the dollar sign ($).
- SAS uses a special system to keep track of the date and time value.
Date
0 = January 1, 1960
1 = January 2, 1960
...
1000 = September 27, 1962
Time
0 = 0:00:00
1 = 0:00:01
60 = 0:01:00
3600 = 1:00:00
The system keeps the date and time values in a numeric variable so that you can easily calculate the duration between different time point. - The Date and Time format allow you to display the date and time value properly in SAS.
- You can also create your own format using Proc Format.
- Last but not least, the (Best.) format allows you to display the internal values of the variable. It removes all the special formats from the variable.