Online Test Banks
Score higher
See Online Test Banks
eLearning
Learning anything is easy
Browse Online Courses
Mobile Apps
Learning on the go
Explore Mobile Apps
Dummies Store
Shop for books and more
Start Shopping

Cheat Sheet

SPSS For Dummies

From SPSS For Dummies, 2nd Edition by Arthur Griffith

SPSS is an application that performs statistical analysis on data. Entering and manipulating information in the application can be done by using SPSS’s proprietary language, which is known as the Syntax command language, or more commonly, as Syntax. The language is quite like other programming languages, and it allows you to define variables (or use predefined ones), and to use them within statements, or to evaluate them with relational or logical operators. Good programmers always know to make their code accessible through the use of comments. Syntax can also be used in conjunction with Basic and Python.

SPSS Syntax Language Variable Definitions

In Syntax, you can define several different characteristics for each of your variables. Here is the full collection of possibilities among SPSS Syntax language variables:

  • Name: Short form of the variable name

  • Type: Numeric, comma, dot, scientific notation, date, dollar, custom currency, or string

  • Width: Maximum number of characters used to display the data

  • Decimals: Number of digits to the right of the decimal point

  • Label: Long form of the variable name

  • Values: Names assigned to specific values

  • Missing: Value, or values, to represent missing values

  • Columns: Number of spaces into which the value is displayed

  • Align: Right, left, or center

  • Measure: Scale, ordinal, or nominal

  • Role: Input, target, both, none, partition, or split

SPSS Syntax Language Statements

A single Syntax language instruction can be very simple, or it can be complex enough to serve as an entire program. A single instruction consists of a command followed by arguments to modify or expand the actions of the command, as follows:

command [/option=value]terminator

command: Every statement begins with a command.

option: Each command has a specific set of options.

value: The value, or values, for the option.

terminator: Every statement ends with a period as a terminator.

SPSS Syntax Language Predefined Variables

Most of the values used in Syntax are from the variables in the data set you currently have loaded and displayed in SPSS. You simply use your variable names in your program, and SPSS knows where to go and get the values for it.

Some other variables are already defined, and you can use them anywhere in a program. Predefined variables, which are called system variables, all begin with a dollar sign ($) and already contain values.

The system variables are listed in the table below:

Variable Name What It Is
$CASENUM Current case number. It is the count of cases from the beginning to the current one.
$DATE Current date in international format with two-digit year.
$DATE11 Current date in international format with four-digit year.
$JDATE Count of the number of days since October 14, 1582 (the first day of the Gregorian calendar).
$LENGTH Current page length.
$SYSMIS System missing value. This prints as a period (.) or whatever is defined as the decimal point.
$TIME Number of seconds since midnight October 14, 1582 (the first day of the Gregorian calendar).
$WIDTH Current page width.

SPSS Syntax Language Comments

You can insert descriptive text, called a comment, into your program. This text doesn't do anything except help make things clear when you read (or somebody else reads) your code. You start a comment the same way you start any other command: on its own line by using the keyword COMMENT or an asterisk or an asterisk-slash. The comment is terminated by a period. For example:

COMMENT This is a comment and will not be executed.
* This is a comment and will continue to be
  a comment until the terminating period.
/* This is a comment and will continue to be
  a comment until the terminating asterisk-slash */

SSPS Syntax Language Relational Operators

Syntax offers conditional statements that are executed only if conditions are right. Usually those conditions are determined by evaluating the contents of a variable with a logical or relational operator. The following table lists the relational operators you can use to compare numbers:

Symbol Alpha What It Is
= EQ Is equal to
< LT Is less than
> GT Is greater than
<> NE Is not equal to
<= LE Is less than or equal to
>= GE Is greater than or equal to

SPSS Syntax Language Logical Operators

Syntax offers conditional statements that are executed only if conditions are right. Usually those conditions are determined by evaluating the contents of a variable with a logical or relational operator. The following table lists the logical operators you can use for longer, complex comparisons:

Symbol Alpha Definition
& AND Both relational operators must be true
| OR Either relational operator can be true
~ NOT Reverses the result of a relational operator
  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus
Advertisement

Inside Dummies.com

Dummies.com Sweepstakes

Win $500. Easy.