Transforming Data with SAS Functions | |
Converting Data with Functions |
Automatic Character-to-Numeric Conversion
Let's begin with the automatic conversion of character values to numeric values.
By default, if you reference a character variable in a numeric
context, such as an arithmetic operation, SAS software tries to
convert the variable values to numeric. For example, in the DATA step below,
the character variable data hrd.newtemp; set hrd.temp; Salary=payrate*hours; run;
When this step is executed, SAS software automatically converts the character
values of Whenever data is automatically converted, a message is written to the SAS log stating that the conversion has occurred. |
SAS Log
4 data hrd.newtemp; 5 set hrd.temp; 6 Salary=payrate*hours; 7 run; NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column). 6:11 NOTE: The data set Hrd.Newtemp has 40 observations and 19 variables. NOTE: The data statement used 0.78 seconds. |
When Automatic Conversion Occurs
Automatic character-to-numeric conversion occurs when a character value is
|
Copyright © 2002 SAS Institute Inc.,
Cary, NC, USA. All rights reserved.