Search notes:

SAS macro: boolean representation

true: 1 / false: 0

A true value is represented by a 1, a false value by a 0.
%macro tq84_put_condition(expr);
   %put &expr : %eval(&expr);
%mend  tq84_put_condition;

%tq84_put_condition(4 < 10); /* 4 < 10 : 1 */
%tq84_put_condition(4 > 10); /* 4 > 10 : 0 */
Github repository about-SAS, path: /macro-processor/bool/condition.sas

Expressions

%macro tq84_bool(expr);

  %if &expr
  %then %put >&expr< is true;
  %else %put >&expr< is false;

%mend tq84_bool;


%tq84_bool(        0    );   /*  >0< is false         */
%tq84_bool(        1    );   /*  >1< is true          */
%tq84_bool(        1-1  );   /*  >1-1< is false       */
%tq84_bool(        1+1  );   /*  >1+1< is true        */
%tq84_bool(%nrstr(  0  ));   /*  >  0  < is false     */
%tq84_bool(%nrstr(  1  ));   /*  >  1  < is true      */
%tq84_bool(  abc > def  );   /*  >abc > def< is false */
%tq84_bool(  abc eq abc );   /*  >abc eq abc< is true */
Github repository about-SAS, path: /macro-processor/bool/expression.sas

See also

macros

Index