From the course: SAS® 9.4 Cert Prep: Part 10 Manipulating Data with Functions

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Converting character values to numeric values

Converting character values to numeric values - SAS Tutorial

From the course: SAS® 9.4 Cert Prep: Part 10 Manipulating Data with Functions

Converting character values to numeric values

- [Instructor] Let's start by looking at the input function. Suppose you have a table with a Date column that is defined as character, and you want to be able to do calculations on the date. You can use the input function to do this conversion. The input function has two arguments. The first argument is the source, or the column that needs to be converted. The second argument is the informat. The informat tells SAS how the data in the input table is displayed so it knows how to read it in. Here's some examples of character values, the informat that you could specify to read the value in, and the resulting numeric value. For the width, you must specify a value that accommodates all the characters in the value you want to convert. When the character value includes a decimal point, you do not need to specify a decimal value in the informat to return a numeric value with a decimal point in the same position. If you use a…

Contents