SPSS LTRIM Function

Summary SPSS LTRIM (left trim) removes leading spaces from string values. These occur especially when converting numbers to strings by using the string function.* For removing trailing rather than leading spaces, see RTRIM. Results of CONCAT with and without LTRIM SPSS Ltrim Example The syntax below demonstrates a situation where you’ll like to use LTRIM. Running step 1 simply creates a mini dataset. Step 3 uses CONCAT without LTRIM and […]

SPSS REPLACE Function

Definition SPSS REPLACE replaces a substring in a string by a different (possibly empty) substring. SPSS Replace – Removing Spaces URLs are created from “title” by using REPLACE. The syntax below demonstrates how to do this. We have a dataset holding the titles of web pages and we’d like to convert these to URLs. For one thing, we don’t like spaces in […]

SPSS INDEX Function

Summary The SPSS INDEX function returns the position of the first occurrence of a given expression within a string. If the expression does not occur in the string, it returns a zero. As a rule of thumb, always use it as CHAR.INDEX. The reason for this is explained SPSS Unicode Mode. Note that string values are case sensitive. SPSS Index […]

SPSS Main Numeric Functions

This tutorial covers some obvious and some less obvious functions for editing numeric variables. You can follow along with this tutorial by downloading and opening hospital.sav. They syntax we’ll use can be copy-pasted or downloaded here. Specifying User Missing Values This tutorial will only use the last 2 variables in the data.* Before doing anything else, we first specify […]