1. Home
  2. ELSIF directive

ELSIF directive

Introduces a set of alternative statements in a block-if control structure.

No options

Parameter

    expression Logical expression to indicate whether or not the set of statements is to be executed.

Description

A block-if structure consists of one or more alternative sets of statements. The first of these is introduced by an IF statement. There may then be further sets introduced by ELSIF statements. Then you can have a final set introduced by an ELSE statement, and the whole structure is terminated by an ENDIF statement. Full details are given in the description of the IF directive.

Options: none.

Parameter: unnamed.

See also

Directives: IF, ELSE, EXIT, ENDIF, CALCULATE.

Commands for: Program control.

Example

" Example 1:5.3.2, 1:5.4.4 "
PROCEDURE '%TRANSFORM'
" Define the arguments of the procedure."
  OPTION NAME='METHOD'; MODE=t;\ 
    VALUES=!t(Logit,Comploglog,Angular);\ 
    DEFAULT='LOGIT'
  PARAMETER NAME='PERCENT','RESULT';\ 
    MODE=p; SET=yes; DECLARED=yes,no;\ 
    TYPE=!t(scalar,variate,matrix,symmetric,diagonal,table);\
    COMPATIBLE=*,!t(type,nvalues);\ 
    PRESENT=yes,no
  IF METHOD .EQS. 'Logit'
    CALCULATE RESULT = LOG( PERCENT / (100-PERCENT) )
  ELSIF METHOD .EQS. 'Comploglog'
    CALCULATE RESULT = LOG( -LOG((100-PERCENT)/100) )
  ELSIF METHOD .EQS. 'Angular'
    CALCULATE RESULT = ANGULAR(PERCENT)
  ENDIF
ENDPROCEDURE

VARIATE    [VALUES=10,20...90] Every10%
" default setting 'logit' for METHOD "
%TRANSFORM Every10%; RESULT=Logit10%
PRINT      Every10%,Logit10%; DECIMALS=0,3
%TRANSFORM [METHOD=A] 25,50,75; RESULT=Ang25,Ang50,Ang75
PRINT      Ang25,Ang50,Ang75

COMMANDINFORMATION '%TRANSFORM','CAPTION','DOTPLOT','NOTONE';\
  IMPLEMENTATION=tranimp,capimp,dotimp,notimp;\
  CHANNEL=tranchan,capchan,dotchan,notchan;\
  PRESENT=trancheck,capcheck,dotcheck,notcheck
PRINT tranimp,tranchan,trancheck
&     capimp,capchan,capcheck
&     dotimp,dotchan,dotcheck
&     notimp,notchan,notcheck
Updated on June 19, 2019

Was this article helpful?