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 (e.g., 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 (i.e., 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) will assign 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 will fail, and missing data values will be 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 will fail (and the missing data code will be assigned to the result).

Note that 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:

<, <=, >, >=, =, <>

will 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 will evaluate to False.

Other Text (String) Functions

The following functions are available in transformation formulas to operate on text (string) values.


convert argument to upper case


convert argument lower case


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, i.e., the first character in a string is referenced as 1


string length

Using string functions with numeric arguments. When any of the string functions are called with illegal (e.g., numeric) arguments, the function will fail and return the missing data code.

Simple Type Conversion


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; e.g., ToStringEx(1.5,"d.dd") would convert number 1.5 to string "1.50"


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 - Numeric Dates tab)

Using functions with illegal arguments. When these functions are called with illegal arguments they will fail and return the missing data code.