Programming Tips 7
What's the point of using SAS formats?
SAS format is useful when dealing with data that are numeric in nature.
Let's take a look at this example.
The D1 and D2 variables above capture the exact same information.
D1 is a numeric variable with a (dollar9.0) format.
D2, on the other hand, is a character variable containing the full value of the dollar amount (including the dollar sign and the comma separator).
Although both variables capture the same information, D1 is the better way to handle the data.
The dollar amount stored under a character variable (e.g. D2) will not allow summary statistics such as mean and standard deviation to be computed.
When needed, you should always use a numeric variable with a relevant format, as opposed to using a character variable.