Transformation of Text Variables (Variables of Type Text)
Statistica supports numeric as well as variables of type text (see Variable Data Types). In addition, you can attach text labels to numeric values (example, attach label Male to numeric value 1 (see also Notes on Text Labels and Text Values). For these variables, transformation formulas are always applied to the numeric representations of values (that is, to numeric value 1 in this case).
Concatenating Text Values (+)
Use the standard arithmetic operator for addition of numbers ("+") to concatenate strings. For example, the transformation V1="Good "+"Program" (e.g., entered into the Batch Transformations editor, see Batch Transformation Formulas) assigns the text value Good Program to all cells in variable 1.
- Concatenating text with numeric values
- When you use the "+" (concatenation) operator with text values and numeric values, the operation fails, and missing data values are assigned to the results. This is also the case when you attempt to concatenate numeric values with text labels and true text variables (variables of type
Text; see also
Variable Data Types). The result of this operation is ambiguous, and hence, the operation fails (and the missing data code is assigned to the result).
Note: You can also use the ToString(x) and ToNumber(x) (and related) functions to perform type conversions prior to the concatenation.
Logical Operators
The logical operators:
<, <=, >, >=, =, <>
Perform (case-sensitive) lexigraphical comparisons between strings; the results of these comparisons evaluate to either True or False.
- Comparing text with numeric values
- All (illegal) comparisons between text and numeric values evaluate to
False.
Other Text (String) Functions
The following functions are available in transformation formulas to operate on text (string) values.
UCase(Str) convert argument to upper case LCase(Str) convert argument lower case LabelOf(v) if variable has text label, return that label as string StrComp(Str1, Str2) return -1, 0, 1 if Str1 is lexigraphically <, =, or > than Str2 StrIComp(Str, Str) case insensitive version of StrComp Mid(Str, Index, Len) See also Statistica Visual Basic; Return the substring of Str starting at Index for Len characters. NOTE: Index is 1-based, that is, the first character in a string is referenced as 1. Len(Str) string length - Using string functions with numeric arguments
- When any of the string functions are called with illegal (example, numeric) arguments, the function fails and returns the missing data code.
Simple Type Conversion
ToString(x) convert numeric argument x to a string ToStringEx(x, format) convert numeric argument x to a string, using the format specified in the second argument; example, ToStringEx(1.5,"d.dd") would convert number 1.5 to string "1.50" ToNumber(Str) convert string argument Str containing a number in text form (e.g., string "1.45") to the numeric representation (the number 1.45). ToNumberEx(Str, format) convert string argument Str containing a number in text form and formatted as described in format to the respective numeric representation; for example, function ToNumberEx("5/17/62", "mm/dd/yy") would convert the date "5/17/62" to the numerical equivalent Julian date (see also Date Operations dialog box - Numeric Dates tab) - Using functions with illegal arguments
- When these functions are called with illegal arguments they fail and return the missing data code.