14.03.2014 Views

Download Jmp User Guide

Download Jmp User Guide

Download Jmp User Guide

SHOW MORE
SHOW LESS

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

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

Appendix C Formula Functions Reference 469<br />

Conditional Functions<br />

the insert button again to add an else clause. Highlighting then or else and repetitively clicking the<br />

insert button changes the else to expr or adds a new expr clause.<br />

To delete a clause, select the then clause above it and press the delete key on your keyboard or click<br />

the delete button ( ) on the formula editor keypad.<br />

By definition, expressions that evaluate as zero are false. If an expression evaluates as missing, no clauses<br />

are executed and missing is returned. All other numeric expressions are true.<br />

Match<br />

Compares an expression to a list of clauses and returns the value of the resulting expression for the first<br />

matching clause encountered. You provide the matching expression only once and then give a match<br />

value for each clause. When you select Match, the formula editor shows a single Match condition with<br />

a missing expression and a missing then clause, as shown in Figure C.3.<br />

Figure C.3 An Example of Using the Match Function<br />

C Formula Functions Reference<br />

After you select Match, you should highlight either expr, value, or then clause, and then enter an<br />

expression. (Or, if you highlight an expression and click Match, the formula editor creates a new<br />

Match conditional with the original highlighted expression as expr and nothing for the value and else<br />

clause.) Also, keep in mind that:<br />

• Match evaluates faster and uses less memory than an equivalent If because the variable is evaluated<br />

only once for each row in the data table. The If condition must evaluate the variable at each If clause<br />

for each row until a clause evaluates as true. See “Comparing Values,” p. 301, for a comparison of<br />

Match and If conditionals.<br />

• With If and Match, the formula editor searches down from the top of the sequence for the first true<br />

clause and evaluates the corresponding result expression. Subsequent true clauses are ignored.<br />

For example, consider the following two formulas for predicting a child’s height from his age. In each<br />

case there is a base height of 58.125 inches to which a quantity is added depending on the value of the<br />

age variable.<br />

Note: Match ignores trailing spaces, while If does not.<br />

Although Match returns missing for any missing values, you can also specifically match missing values.

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

Saved successfully!

Ooh no, something went wrong!