The %EVAL function evaluates integer arithmetic or logical expressions. %EVAL operates by converting its argument from a character value to a numeric or logical expression. Then, it performs the evaluation. Finally, %EVAL converts the result back to a character value and returns that value.

Operands that contain a period character cause an error when they are part of an integer arithmetic expression. The following examples show correct and incorrect usage, respectively:

`%let d=%eval(10+20); /* Correct usage */` |

`%let d=%eval(10.0+20.0); /* Incorrect usage */` |

When %EVAL encounters a value containing a period, it displays an error message about finding a character operand where a numeric operand is required.

The Log produces…

The %SYSEVALF function evaluates arithmetic and logical expressions using floating-point arithmetic and returns a value that is formatted using the BEST32. format. The result of the evaluation is always text. % SYSEVALF is the only macro function that can evaluate logical expressions that contain floating point or missing values. Specifying a conversion type can prevent problems when %SYSEVALF returns missing or floating point values to macro expressions or macro variables that are used in other macro expressions that require an integer value.

`Syntax: %SYSEVALF(expression<, conversion-type>)` |

Taking an example…

`%let y=%sysevalf(&a +&b, boolean);` |

`%let z=%sysevalf(&a +&b, ceil);` |

`%let v=%sysevalf(&a +&b, floor);` |

`%let w=%sysevalf(&a +&b, int);` |

`%put The result with SYSEVALF is: &x;` |

`%put The BOOLEAN value is: &y;` |

`%put The CEIL value is: &z;` |

`%put The FLOOR value is: &v;` |

`%put The INTEGER value is: &w;` |

The Log produces…