Emily F. Zucker |
Data type conversions are an inevitable part of the job of a SAS programmer. Statistical analysis and mathematical functions require the variables to be numeric, while readability require the variable to be character. Sometimes, you pull in data from a database or excel and it is not read in as the desired data type. You may need to change the type to perform a specific function and then change it back. Changing the data type seems like an easy, fast process initially, but when you can't remember the exact function and inputs for your desired outcome, it can be a frustrating pause to your flow. To reduce this confusion, a deep dive is given to understand how SAS stores character and numeric data, the methods of converting data types with a focus on PUT and INPUT functions, some examples where data conversions are useful for data manipulation, and some memory tricks are offered to hopefully eliminate that annoying google search once and for all. |