Function List

This section contains a listing of all the functions in the IBM SPSS Data Collection Function Library. For full details and examples of usage, see the Data Collection Function Library topics in the IBM® SPSS® Data Collection Scripting section of the IBM® SPSS® Data Collection Developer Library.

Categorical Functions

FunctionDescription
AnswerCount(Val)
Returns the number of categories selected in a category list.
ContainsAll(Val, Answers [, Exactly])
Identifies whether a category list contains all of the categories in a given list.
ContainsAny(Val, Answers [, Exactly])
Identifies whether a category list contains one or more categories in a given list.
ContainsSome(Val, Answers [, Min] [, Max] [, Exactly])
Identifies whether a category list contains some of the categories in a given list.
DefinedCategories(Val [, Answers])
Returns a set of categories of a categorical variable.
DefinedElements(Val [, Types])
Returns a set of elements of a categorical variable.
DefinedFactors(Val [, Answers])
Returns a set of factor numbers as defined on the categories in a variable.
DefinedListElements(Val, Answers [, Types])
Returns a set of elements of a categorical variable.
Difference(Val, Answers)
Returns the difference of two category lists--that is, it returns the categories that are in the first category list but not in the second.
Factor(Val)
Returns the factor defined for an element of a categorical variable.
GetAnswer(Val, Index)
Returns a specified category in a category list.
HasAnswer(Val, Answer)
Identifies whether a specified category is in a category list.
Intersection(Val [, Vals, ...])
Returns the intersection of two or more category lists--that is, it returns the categories that appear in all of the category lists.
LBound(List [, Dimension])
Returns the smallest available subscript for the indicated dimension of an array. By default, the lower bound is returned for the first dimension of the array.
Merge(Vals)
Returns the union of a number of categorical values; that is, returns the categories that are in any of the input categorical values.
ReDim(List, Size [, Preserve])
Re-sizes an array to a given size. By default, the array contents are preserved.
UBound(List [, Dimension])
Returns the largest available subscript for the indicated dimension of an array. By default, the upper bound is returned for the first dimension of the array.
Union(Val [, Vals, ...])
Returns the union of two or more category lists--that is, it returns all of the categories that are in one or more of the category lists.
Unique(Val)
Returns a category list with any duplicate categories removed.
XUnion(Val, Answers)
Returns the exclusive union of two category lists--that is, it returns all of the categories that are in either one of the category lists, but not in both.

Text or Categorical Functions

FunctionDescription
Find(Val, Key [, Skip [, Reverse]])
Searches a string or category list for a specified substring or subcategory list, and if it is found, returns its start position. Note that the search is case insensitive.
Left(Val, Length)
Returns either a string containing the first characters from a string, or a category list containing the first categories from category list.
Len(Val)
Returns a Long containing the number of characters in a string or the number of categories in a category list.
Mid(Val, Start [, Length])
Returns either a string containing a specified number of characters from a specified position in a string, or a category list containing a specified number of categories from a specified position in a category list.
Right(Val, Length)
Returns either a string containing the last characters from a string, or a category list containing the last categories from category list.

Text Functions

FunctionDescription
AscW(Val)
Returns an integer value representing the Unicode character code for a character.
ChrW(Val)
Returns the character that corresponds to a given Unicode character code.
Format(Val [, Style [, Width [, Locale]]])
Returns a string that is the result of formatting a value according to a specified style.
Hex(Val)
Returns a string representing the hexadecimal value of a number.
LCase(Val)
Returns a string that has been converted to lower case.
LTrim(Val)
Returns a copy of a string with leading spaces removed.

MakeMDMName(Val)

Replaces characters that are not allowed in the name of an MDM object, to produce a valid name.
MakeString(Vals)
Returns a text string by concatenating one or more values.
Oct(Val)
Returns a string representing the octal value of a number.
RTrim(Val)
Returns a copy of a string with trailing spaces removed.
Split(Val [, Delimiter [, Count ]])
Returns an array that contains substrings.
Trim(Val)
Returns a copy of a string with both leading spaces and trailing spaces removed.
UCase(Val)
Returns a string that has been converted to upper case.

Date and Time Functions

FunctionDescription
DateAdd(Val, Interval, Count)
Returns a date to which a specified time interval has been added.
DateDiff(Val1, Val2, Interval)
Returns the time interval between two dates.
DateNow([ Val [, IgnoreDaylightSaving]])
Returns the current local date in a particular time zone.
DateOnly(Val)
Returns the date from a date and time value.
DatePart(Val, Interval)
Returns a specified part of a given date.
Day(Val)
Returns a whole number between 1 and 31, inclusive, representing the day of the month.
GetTimeZone([Val])
Returns the index value of a time zone defined in the registry on the server.
GetTimeZoneDaylightSaving([Val [, Time]])
Returns True if daylight-saving is currently in effect at the specified time in the specified time zone, or False if not.
GetTimeZoneName([Val])
Returns the name of the local time zone.
GetTimeZoneOffset([Val [, Time [, IgnoreDaylightSaving]]])
Returns the number of minutes to add to or subtract from UTC time to get the local time.
Hour(Val)
Returns a whole number between 0 and 23, inclusive, representing the hour of the day.
LocalToUTCTime(Val [, Zone [, IgnoreDaylightSaving]])
Returns the UTC time that corresponds to a given local time.
Minute(Val)
Returns a whole number between 0 and 59, inclusive, representing the minute of the hour.
Month(Val)
Returns a whole number between 1 and 12, inclusive, representing the month of the year.
MonthName(Val [, Abbreviate [, Locale ] ])
Returns a string indicating the specified month.
Now([ Val [, IgnoreDaylightSaving]])
Returns the current local date and time in a particular time zone.
Second(Val)
Returns a whole number between 0 and 59, inclusive, representing the second of the minute.
SetTimeZone(Val)
Sets the time zone for a program.
TimeNow([ Val [, IgnoreDaylightSaving]])
Returns the current local time in a particular time zone.
TimeOnly(Val)
Returns the time from a date and time value.
UTCToLocalTime(Val [, Zone [, IgnoreDaylightSaving]])
Returns the local time that corresponds to a given UTC time.
WeekdayName(Val [, Abbreviate [, Locale ] ])
Returns a string indicating the specified day of the week.
Year(Val)
Returns a whole number representing the year.

Conversion Functions

FunctionDescription
CBoolean(Val)
Converts a value of any data type to a Boolean value.
CCategorical(Val)
Converts a value of any data type to a Categorical value.
CDate(Val)
Converts a value of any data type to a Date value.
CDouble(Val)
Converts a value of any data type to a Double value.
CLong(Val)
Converts a value of any data type to a Long value.
CText(Val)
Converts a value of any data type to a Text value.

Random Number Functions

FunctionDescription
GetRandomSeed()
Returns the current starting point of the random number generator.
RanInt([Seed])
Returns a random integer number.
Rnd([Seed])
Returns a random decimal number.
SetRandomSeed([Seed])
Sets the starting point for the random number generator.

List Functions

FunctionDescription
FindItem(List, Key)
Returns a specified item from a list, or NULL if the item isn't found.
GetReversalSeed()
Returns the current reversal state (which is used by the Rev function).
GetRotationSeed()
Returns the current rotation state (which is used by the Rot function).
Ran(List [, Count [, Seed]])
Returns a randomized copy of a list. An optional parameter defines how many items from the input list are included in the randomized list.
RanSequence(Start, End [, Step [, Count[, Seed]]])
Returns an array containing values selected randomly from a given series of integers.
Rev(List [, Count [, Policy [, Seed]]])
Returns an array containing copies of items from an input list, either in the normal order or in reverse order. The optional Count parameter defines how many items from the input list are included in the returned list.
RevSequence(Start, End [, Step [, Count[, Policy[, Seed]]]])
Returns an array containing values selected from a given series of integers, either in the original order or in reverse order.
Rot(List [, Count [, Policy [, Seed]]])
Returns an array containing copies of items from the input list, in a rotated order. The optional Count parameter defines how many items from the input list are included in the returned list.
RotSequence(Start, End [, Step [, Count[, Policy[, Seed]]]])
Returns an array containing values selected from a given series of integers in a "rotated" order.

SelectRange(List [, Range [, Count]])

Returns an array containing copies of selected items from the input list.
SetReversalSeed([Seed])
Sets the reversal state.
SetRotationSeed([Seed])
Sets the rotation state.
SortAsc(List [, Count [, IgnoreLocale]])
Returns an array containing copies of items from the input list, sorted in ascending order. The optional Count parameter defines how many items from the input list are included in the returned list.
SortDesc(List [, Count [, IgnoreLocale ]])
Returns an array containing copies of items from the input list, sorted in descending order. The optional Count parameter defines how many items from the input list are included in the returned list.

Mathematical Functions

FunctionDescription
Abs(Val)
Returns the absolute value of a number.
Atn(Val)
Returns the arctangent of a number.
Cos(Val)
Returns the cosine of an angle.
Exp(Val)
Returns e (the base of natural logarithms) raised to a power.
Int(Val)
Returns the integer portion of a number.
Log(Val [, Base])
Returns the logarithm of a number.
MaxOf(Val1 [, Vals, ...])
Returns the maximum of two or more values.
MinOf(Val1 [, Vals, ...])
Returns the minimum of two or more values.
Pow(Val1, Val2)
Returns the value of a number raised to a power.
Round(Val [, Digits [, Policy]])
Returns a number rounded to a specified number of decimal places or significant digits.
Sgn(Val)
Returns an integer that indicates the sign of a number.
Sin(Val)
Returns the sine of an angle.
Sqrt(Val)
Returns the square root of a number.
Tan(Val)
Returns the tangent of an angle.

Miscellaneous Functions

FunctionDescription
Band(Val, Min, Size [, Count])
Calculates categories (called bands) for a numeric variable and returns the appropriate category for a specified value in the numeric variable.
BitAnd(Val1 [, Vals, ...])
Performs a bitwise AND on two or more numeric values and returns the result.
BitNot(Val)
Performs a bitwise NOT on a numeric value and returns the result.
BitOr(Val1 [, Vals, ...])
Performs a bitwise OR on two or more numeric values and returns the result.
BitXor(Val1 [, Vals, ...])
Performs a bitwise XOR on two or more numeric values and returns the result.
CreateObject(Class)
Creates and returns a reference to an Automation object.
DBNull()
Returns a NULL data value for use with ADO.
EngineVersion([Val [, Number]])
Returns part or all of the engine's version number.
EqualBand(Val, Count, Min, Max)
Calculates a specified number of equal categories (called bands) for a numeric variable and returns the appropriate category for a specified value in the numeric variable.
Eval(Expr)
Evaluates an expression and returns the result.
Execute(Script)
Executes one or more specified statements.
GetInterface(Object, InterfaceID)
Returns an alternate interface for an object.
IIf(Val, TruePart, FalsePart)
Returns the value passed as the TruePart parameter if the expression evaluates to True, otherwise returns the value passed as the FalsePart parameter.
InputBox(Prompt[, Default[, Title]])
Displays a dialog box containing a specified message, a text box for input, an OK button, and a Cancel button.
IsDBNull(Val)
Returns true if a value is a NULL data value that can be used by ADO.

IsElementInVersions(Val, Elem, Versions)

Tests whether an element or list exists in all specified versions of a variable.
IsEmpty(Val)
Returns True if the value is empty. A string containing no characters or just containing white spaces is considered to be empty. A category list containing no categories is considered to be empty. All other data types are always considered to be not empty.
IsEqualObject(Val1, Val2)
Returns True if two values refer to the same object.
IsNullObject(Val)
Returns true if an variable is NULL, without testing the default property of the object being referenced.
IsOneOf(Val1 [, Vals, ...])
Returns true if a value is equal to at least one of the other listed values.
IsSet(Val, Mask)
Returns True if an integer value matches a specified mask.
Replace(Val, Key, Replacement [, Start [, Count [, IgnoreCase]]])
Replaces part of a text or categorical value with another value of the same type.
RGB(Red, Green, Blue)
Returns a number representing an RGB color value.
ShellExecute(File [, HWnd [, Verb [, Parameters [, Directory [, ShowCmd]]]]])
Performs an operation on a specified file.
Sleep(Val)
Suspends the thread in which it is called.
Validate(Val [, Min [, Max [, Expr [, Describe ] ] ] ])
Validates a specified value based on specified minimum and maximum values and optionally a validating expression.
VarType(Val)
Returns a numeric value indicating the subtype of a variable.
VarTypeName(Val)
Returns a string indicating the subtype of a variable.