The data used (values of macro variables `a` and `b`) are created and defined directly within the SAS script.
1 Code Block
GLOBAL STATEMENT / MACRO STATEMENT Data
Explanation : Activates the SYMBOLGEN option to display macro variable resolution in the log. Then defines two macro variables, `&a` as an integer and `&b` as a floating-point number, which will be used in subsequent calculations.
Copied!
OPTIONS SYMBOLGEN;
%let a = 100;
%let b = 1.59;
1
OPTIONS SYMBOLGEN;
2
3
%let a = 100;
4
%let b = 1.59;
2 Code Block
MACRO FUNCTION
Explanation : Calculates the sum of macro variables `&a` and `&b` using `%SYSEVALF`, which allows handling floating-point numbers without error. The result is stored in macro variable `&y`. Then, several `%PUT` statements display the base result and the results of specific `%SYSEVALF` conversions (BOOLEAN, CEIL, FLOOR, INTEGER), demonstrating how the function can modify the format and value of the result.
Copied!
%let y = %sysevalf(&a+&b);
%put The result with SYSEVALF is: &y;
%put BOOLEAN conversion: %sysevalf(&a +&b, boolean);
%put CEIL conversion: %sysevalf(&a +&b, ceil);
%put FLOOR conversion: %sysevalf(&a +&b, floor);
%put INTEGER conversion: %sysevalf(&a +&b, integer);
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
Copyright Info : Educational source: Lesson 2.4: Using the %SYSEVAL Function, Lesson 2 - Using Macro Functions, SAS Macro Language 1: Essentials.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.