if
|
Creates an "if" block. If the expression in parentheses after
if is true, the formula returns the upper value; if not, it returns the lower. The example at left returns "big" if the value for xx is greater than 2 and "small" otherwise. See Express a Condition with an If-Statement.
|
switch
|
Acts like a sophisticated
if ; very useful for recoding attributes. It takes an optional expression inside parentheses and then evaluates each of any number of true/false expressions to determine which value to return. This is best done with a couple of examples.
Fathom interprets this by substituting
age for ? in each of the expressions, starting at the top, until it finds one that is true. It returns the value to the right of the colon for that expression. So, if age is 45, the value of the entire expression is "mature."
Here's another example, one that might be used to recode numeric data from the census into meaningful phrases. Fathom compares the value of eduCode with each of the numbers in parentheses and returns the expression to the right of the first one that matches. If none match, it returns the value of the expression to the right of
else . See Recode with a Switch Statement, Recode Numeric Values to Categories, and Recode Ranges of Numeric Values to Categories.
|
Key Curriculum Press/Key College Publishing www.keypress.com/fathom |