Logical functions
Logical functions in FastStats allow conditional operation.
They can also be used to set a value according to the result. The value returned is 0.0 if the expression evaluates to false, 1.0 if the expression evaluates to true, or missing value if the answer is undefined due to missing values.
If¶
If (A,B,C)- if condition A then use value B else use value C.If (A,B)- if condition A then use value B else use missing value.
Examples:
Case¶
Case(A,a,B,b,C,c ...) – if condition A then use value a, condition B then use value b, etc..
Examples:
Or¶
Or(A,B,C...) - evaluates to true if condition A is true OR condition B is true etc., otherwise evaluates to false.
And¶
And(A,B,C...) - evaluates to true if condition A is true AND condition B is true etc., otherwise evaluates to false.
InList¶
InList(X,A,B,C ...) - greater than 1 if expression X takes value of expression A or B or C ...
Example:
This will return 1 if [Cost] is 790, 2 if ([Cost]+10) is 790, etc.
InListAllMatches¶
Calculates the value of the “Expression” defined in the first parameter.
The result of this expression can be a numeric, string or date type. The “Values” are then checked against the result.
Returns a numeric list containing the index of all the value parameters which match the expression result. If there is no match then empty list is returned. You can also set the match parameters from a list.
For example, InListAllMatches(Product Code, "ABC", "DEF", "GHI") returns a numeric list with 1 in it if the Product Code is ABC, 2 in it if it is DEF, 3 in it if it is GHI, and an empty list if none of them match.
Index¶
Index(X,A,B,C ...) selects Xth item (1-based) from the list (A,B,C ...).
For example:
The above expression returns 2.The match parameters can also be set from a list.
IndexFromList¶
Calculates the values of the “NumericList Expression” defined in the first parameter.
Returns a list of the values represented by the corresponding positions in the list of "Values". You can also set the match parameters from a list.
For example, IndexFromList(CreateList(2, 3), "a", "b", "c") returns a list with "b" and "c" in it.
MaxIndex¶
Returns the index of the maximum value in a list of values
For example:
The above expression returns 2.
The second number is the highest in this list.
MinIndex¶
Returns the index of the minimum value in a list of values.
For example:
The above expression returns 3.
The third number is the lowest in this list.
Not¶
Returns the logical opposite of the input logical expression.
Examples:
ValidEmail¶
Determines whether an email address is in a valid format.
Returns 1 if true and 0 if false.