 SPSS TUTORIALS BASICS ANOVA REGRESSION FACTOR CORRELATION

# SPSS – Set Missing Values with Syntax

When working with SPSS, specifying missing values correctly is often an essential step in analyzing data. This tutorial demonstrates how to set missing values the right way.

## Setting Missing Values in SPSS

• Perhaps unsurprisingly, missing values can be specified with the `MISSING VALUES` command.
• A thing to note, however, is that missing values can be specified for multiple variables at once.
• Second, missing values may be specified as a range. If a range is used, a single discrete missing value can be added to it.
• The syntax example below gives some examples of this.

## SPSS Missing Values Syntax Examples

(The test data used by the syntax below are found here.)

*1. Specifying 4 and 5 as missing values for "married".

missing values married(4,5).

*2. Specify a range (1,000,000 and upwards) as missing values for "income".

missing values income (1000000 thru hi).

*3. Specify 2 as missing value for variables q1 through q3.

missing values q1 to q3 (2).

## Changing Columns in SPSS

• Columns refers to how wide a variable column is displayed on screen. It can be set by the `VARIABLE WIDTH` command.
• This may be confusing since this does not refer to the "width" (length) of a variable as explained under variable width.
• Although setting columns doesn't affect your actual data, it's of minor importance. For the sake of completeness, the syntax example below demonstrates the command.

## SPSS Variable Width Syntax Example

(The test data used by the syntax below are found here.)

*Set columns = 50 for q1 through q3..

variable width q1 to q3 (50).

## Changing Variable Alignment in SPSS

• Variable alignment refers to how data values are aligned within their columns. The options are "left", "centered" or "right".
• As in MS Excel, the default settings are left for string variables and right for numeric variables.
• These can be overridden by the `VARIABLE ALIGNMENT` command as demonstrated below.

## SPSS Variable Align Syntax Example

(The test data used by the syntax below are found here.)

*Set Variable Alignment = center for q1 through q3.

variable alignment q1 to q3 (center).

## Changing Measurement Levels in SPSS

• On a personal note, we feel the Measure property for setting measurement levels is rather useless. This is something that users - not software - should be aware of and take into account when analyzing data.
• Regretfully, some commands (most notably `CTABLES`) are actually affected by the measurement levels as specified by the user.
• In this case, the `VARIABLE LEVEL` command can be used for setting them to nominal, ordinal or scale (for metric variables).

## SPSS Variable Level Syntax Example

(The test data used by the syntax below are found here.)

*Set measurement level to scale for "birthday", ordinal for "married" and nominal for q1 through q3.

variable level birthday(scale) married(ordinal) q1 to q3 (nominal).

## Changing Roles in SPSS

• Just as with Measure, we feel the "Role" property is rather useless and had perhaps better be removed from SPSS.
• For the sake of completeness, it can be modified as demonstrated below.

## SPSS Variable Role Syntax Example

(The test data used by the syntax below are found here.)

*Set role to input for "married", target for "income" and both for "q1" through "q3".

variable role
/input married
/target income
/both q1 to q3.

# Tell us what you think!

*Required field. Your comment will show up after approval from a moderator.

# THIS TUTORIAL HAS 13 COMMENTS:

• ### By Harlan on March 19th, 2021

These statements actually don't work. Is and execute statement also needed, if so, you need to include it.

• ### By Ruben Geert van den Berg on March 19th, 2021

The commands work fine. EXECUTE is not needed because these are not SPSS transformation commands.

• thank you