Unicode

Introduction You may have heard the phrase that “computers only process ones and zeroes”. These are formally referred to as bits. This raises the question how computers represent letters (like Y, e and s). Representing characters using only bits basically involves two steps. First, each letter is represented by a number. Second, each number is represented by […]

SPSS Macros

Definition An SPSS macro is a function defined by the user in order to automate some task(s). SPSS Macro Syntax As discussed earlier, Python uses program blocks that start with BEGIN PROGRAM. and end with END PROGRAM.. A different kind of program block may start with DEFINE and end with !ENDDEFINE.. Between these commands you’ll find code that looks a lot like basic […]

SPSS LAG Function – What and Why?

In SPSS, LAG is a function that returns the value of a previous case. It’s mostly used on data with multiple rows of data per respondent. Here it comes in handy for calculating cumulative sums or counts. SPSS Lag Function SPSS LAG – Basic Example 1 The most basic way to use LAG is COMPUTE V1 = LAG(V2). This […]

SPSS DO IF – Simple Tutorial

SPSS transformations between DO IF … and END IF are applied only to cases (rows of data) that satisfy one or more conditions. In many cases, IF is a faster way to accomplish the same results. SPSS Do If Example Say we’d like to convert people’s monthly income into income classes. We may want to use different cut […]

SPSS Datasets

This tutorial explains what SPSS datasets are. For a practical tutorial on working with datasets, see SPSS Datasets Tutorial 1 – Basics. Right, now an SPSS dataset is SPSS data that only exists in your computer’s working memory (RAM). Changes you make to it are discarded unless it’s saved as a data file. SPSS Data File and Dataset […]

SPSS ANY Function

Definition SPSS’ ANY is used to compare one value to a set of other values. SPSS Any – Basics ANY(a,b,c[,d…]) checks whether a is equal to any of the b, c[,d…]. Note that the first value is compared to the second through the last values. Each of these can either be a constant (“6”) or a variable (“v1”) over respondents. SPSS Any – Examples Suppose […]

SPSS Transformation Commands

Summary SPSS transformation commands (or simply “transformations”) can be loosely defined as commands that are not immediately carried out when you run them. Instead, they are kept in mind by SPSS and executed only when necessary. The table below gives an overview of SPSS’ main tranformation commands. Main SPSS Tranformation Commands COMMAND NAME GOAL TYPICAL USAGE […]

Assumption of Equal Intervals – Calculations on Ordinal Variables

The assumption of equal intervals says that all distances between adjacent answer categories are equal in the repondents’ perception. This assumption is an attempt to justify treating ordinal variables as if they were metric variables. Doing so enables one to compute means, standard deviations and Pearson correlations on ordinal variables. This is simpler than using more appropriate techniques. Assumption of Equal […]

SPSS RV Function

Basic Use COMPUTE v1 = RV.NORMAL(0,1). Summary In SPSS, RV is short for random variable. It draws random values from a given probability distribution.* The latter is specified as a period separated suffix as in RV.BERNOULLI(.5).RV is mostly but not necessarily used with COMPUTE. Random Sample (N = 10,000) from a Standard Normal Distribution SPSS Rv Examples A nice way to get […]

SPSS RANGE Function – Quick Tutorial

COMPUTE v2 = RANGE(V1,2,4). SPSS RANGE Function Result Summary SPSS’ RANGE function is used to evaluate whether or not values are within a given range. Test values equal to the lower or upper boundary are also within the given range. Run the syntax below for a quick demonstration. SPSS Range Syntax Example *1. Create couple of cases. data list free/v1(f1). begin […]

SPSS Scratch Variables

Definition Scratch variables are temporary helper variables that don’t show up in your data. A variable is a scratch variable if (and only if) its name starts with “#”. SPSS Scratch Variable – Introduction Say we have a data file holding phone numbers. Now we’d like to extract the area codes into a separate variable. […]

Python Xlrd (Excel Read) Module

xlrd is a module that allows Python to read data from Excel files. This tutorial explains where to get it and how to install it. Downloading the Python Xlrd Module The Python xlrd (short for “Excel Read”) module can be found here. After downloading it, you can extract the contents (twice) with 7 Zip. Copy the path of the folder that […]

SPSS FORMATS – Set Display Format for Variables

SPSS FORMATS sets formats -decimal places, dates, percent signs and more- for numeric variables. Setting variable formats in SPSS does not change your actual data values. However, formats determine how your data are displayed -in the data viewer as well as the output-window. Two main uses of FORMATS are increasing or decreasing the decimal places of standard numeric variables; displaying date, time and datetime values (consisting […]

SPSS Unicode Mode

SPSS Unicode mode is a setting which implies that all text is encoded as UTF-8 (Unicode Tranformation Format – 8 bit). Note that this tutorial leans substantively on Unicode. SPSS Unicode Mode – What and Why Up to version 15, all character encoding in SPSS was based on code pages. SPSS using code pages is now […]

SPSS TEMPORARY Command

Summary In SPSS, TEMPORARY indicates that the commands that follow are temporary. Temporary commands will be undone (reversed) when a command is run that reads the data. Such a command also indicates that the commands that follow are not temporary anymore. Temporary commands between TEMPORARY and a command that reads the data. SPSS Temporary Example “We’d like to dichotomize […]

SPSS System Variables

Summary SPSS uses a handful of hidden variables for keeping track of things. These so called system variables have names starting with “$” and can be useful in some cases. The most important one is $casenum, the number shown next to each case in the data editor window. SPSS $casenum SPSS $casenum In the left outline of the […]

Command Syntax Reference

Introduction SPSS ships with a manual called “Command Syntax Reference” (or CSR). Whenever you don’t know or understand something, this should usually be the first place to look. SPSS Command Syntax Reference SPSS comes with a syntax reference manual explaining all existing commands. This book (in .pdf format) is called the “Command Syntax Reference” and is mostly […]

SPSS RANK Command

Summary SPSS RANK can be used to create a variable holding the rank numbers of the values of some other variable. RANK is also used for discretizing continuous variables into ntile groups. This tutorial walks you through the main options along with some real world examples. Result of first RANK syntax example 1. SPSS Rank Basic Example Running the syntax below first creates […]

Escape Sequence (General Concept)

Introduction An escape sequence is a combination of characters that has a special meaning. Escape Sequences in General Some characters imply a special function rather than their “normal” meaning. For example, ‘ often implies the start or the end of a string. But what if you actually mean ‘ rather than a string? In that case you can escape its default meaning by prefixing […]

SPSS ALTER TYPE – Simple Tutorial

SPSS ALTER TYPE command is mainly used for converting string variables to numeric variables. However, it has other interesting applications as well. This tutorial quickly walks you through those, pointing out some pitfalls, tips and tricks along the way. You can follow along by downloading and opening holidays.sav but you do need SPSS version 16 or higher for using ALTER […]