Variable Type Conversions

If you define a numeric variable and assign the result of a character expression to it, SAS tries to convert the character result of the expression to a numeric value and to execute the statement. If the conversion is not possible, SAS prints a note to the log, assigns the numeric variable a value of missing, and sets the automatic variable _ERROR_ to 1. For a listing of the rules by which SAS automatically converts character variables to numeric variables and vice versa, see Automatic Numeric-Character Conversion.
If you define a character variable and assign the result of a numeric expression to it, SAS tries to convert the numeric result of the expression to a character value using the BESTw. format, where w is the width of the character variable and has a maximum value of 32. SAS then tries to execute the statement. If the character variable that you use is not long enough to contain a character representation of the number, SAS prints a note to the log and assigns the character variable asterisks. If the value is too small, SAS provides no error message and assigns the character variable the character zero (0).
Automatic Variable Type Conversions (partial SAS log)
44   data _null_;
45      x= 3626885;
46      length y $ 4;
47      y=x;
48      put y;
49   run;
NOTE: Numeric values have been converted to character 
      values at the places given by: (Line):(Column).
      47:6   
36E5
      
50   data _null_;
51      x1= 3626885;
52      length y1 $ 1;
53      y1=x1;
54      xs=0.000005;
55      length ys $ 1;
56      ys=xs;
57      put y1= ys=;
58   run;
NOTE: Numeric values have been converted to character 
      values at the places given by: (Line):(Column).
      53:7   56:7   
NOTE: Invalid character data, x1=3626885.00 , at line 53 column 7.
y1=* ys=0
x1=3626885 y1=* xs=5E-6 ys=0 _ERROR_=1 _N_=1
NOTE: At least one W.D format was too small for the number to be printed. The 
      decimal may be shifted by the "BEST" format.
      
59   proc printto; run;
In the first DATA step of the example, SAS is able to fit the value of Y into a 4-byte field by representing its value in scientific notation. In the second DATA step, SAS cannot fit the value of Y1 into a 1-byte field and displays an asterisk (*) instead.