String Variables

SPSS CHAR.SUBSTR Example

String variables are variables that hold zero or more characters such as letters, numbers, spaces, commas and many more. You can't use numeric functions such as addition or subtraction on string variables. You can, however, extract one or more characters (a substring) from them, glue them together (concatenate) and a couple of other functions.
Like so, working with string variables in SPSS is super easy: you just need to know and combine the right building blocks. These are explained and demonstrated in the tutorials listed below. Enjoy!

/

SPSS String Variables

SPSS String Variables Basics

String variables are variables that hold zero or more text characters. This tutorial demonstrates their main properties by running simple examples on a test data file. Read More

SPSS String Variables Tutorial

Working with string variables in SPSS is pretty straightforward if one masters some basic string functions. This tutorial will quickly walk you through the most important ones. Read More

SPSS String Functions

SPSS INDEX Function

The SPSS INDEX function returns the position of the first occurrence of a given expression within a string. If this expression does not occur in the string, it returns a zero. Read More

SPSS LTRIM Function

SPSS LTRIM removes leading spaces from string values. These occur especially when converting numbers to strings by using the string function. Read More

SPSS REPLACE Function

SPSS REPLACE replaces a substring in a string by a different (possibly empty) substring. Read More

SPSS RINDEX Function

The rindex function returns the position of the last occurrence of a substring (often a single character) in a string. If the substring is not present at all, it returns 0. Read More

SPSS RTRIM Function

SPSS Rtrim is sometimes needed for removing trailing spaces when concatenating strings. This tutorial shows some complications that may occur when it's omitted. Read More