13.07.2015 Views

Download pdf guide - VSN International

Download pdf guide - VSN International

Download pdf guide - VSN International

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

106 9 Programs and proceduresdescribed in Section 5.1.)By including ELSIF statements, we can construct a more complicated block-ifstructure.IF Prob .LE. 0.001PRINT 'Probability < 0.1%'ELSIF Prob .LE. 0.01PRINT 'Probability < 1%'ELSIF Prob .LE. 0.05PRINT 'Probability < 5%'ENDIFELSIF statements also each have a logical expression. To execute the block-if structure,GenStat looks at the result of the expression in the IF statement, and then each ELSIFin turn, and executes the statements introduced by the IF or ELSIF that contains the firsttrue result. You can also supply some statements to be executed if none are true; theseare introduced by an ELSE statement. For example,IF Prob .LE. 0.001PRINT 'Probability < 0.1%'ELSIF Prob .LE. 0.01PRINT 'Probability < 1%'ELSIF Prob .LE. 0.05PRINT 'Probability < 5%'ELSEPRINT 'Not significant'ENDIFYou can have any number of control structures (like loops or block-if structures) withinother control structures. We now put a block-if structure within the original loop fromSection 9.1.14 FOR [NTIMES=Nvars; INDEX=i]15 CALCULATE Corr = CORRELATION(Water; Vars[i])16 & Nobservations = NOBS(Water + Vars[i])17 & Abscorr = ABS(Corr)18 PRCORRELATION [NOBSERVATIONS=Nobservations] \19 Abscorr; CUPROBABILITY=Prob20 CALCULATE Prob = 0.5 * Prob21 IF Prob .LE. 0.00122 PRINT [IPRINT=*] 'Correlation',Corr,'Probability < 0.1%';\23 FIELD=11,7,20; DECIMALS=3; JUSTIFICATION=left24 ELSIF Prob .LE. 0.0125 PRINT [IPRINT=*] 'Correlation',Corr,'Probability < 1%';\26 FIELD=11,7,20; DECIMALS=3; JUSTIFICATION=left27 ELSIF Prob .LE. 0.0528 PRINT [IPRINT=*] 'Correlation',Corr,'Probability < 5%';\29 FIELD=11,7,20; DECIMALS=3; JUSTIFICATION=left30 ELSE31 PRINT [IPRINT=*] 'Correlation',Corr,'Not significant';\32 FIELD=11,7,20; DECIMALS=3; JUSTIFICATION=left33 ENDIF34 ENDFORCorrelation 0.413 Probability < 5%Correlation -0.089 Not significantCorrelation 0.631 Probability < 1%Correlation 0.286 Not significant

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!