Overview

GTL supports conditional logic that enables you to include or exclude one or more GTL statements at run time:
IF (condition)
GTL-statement(s);
ELSE
GTL-statement(s);
ENDIF;
The IF statement requires an ENDIF statement. The IF block can be placed anywhere within the BEGINGRAPH / ENDGRAPH block.
The condition is an expression that evaluates to a numeric constant, where all numeric constants other than 0 and MISSING are true. There is an implied EVAL(condition), so it is not necessary to include an EVAL as part of the condition.
Examples:
/* test a computed value */ 
if (weekday(today()) in (1 7))
   entrytitle "Run during the work week";
else
   entrytitle "Run during the weekend";
endif;

/* test for the value a numeric dynamic */ 
if (ADDREF > 0)
   referenceline y=1;
   referenceline y=0;
   referenceline y=-1; 
endif;

/* test for the value a character dynamic */ 
if (upcase(ADDREF) =: "Y")
   referenceline y=1;
   referenceline y=0;
   referenceline y=-1; 
endif;

/* test whether a dynamic is initialized */ 
if (exists(ADDREF))
   referenceline y=1;
   referenceline y=0;
   referenceline y=-1; 
endif;