# SPSS Syntax Exercises

## Set Up

Use the data found in

GET FILE=
'C:\Program Files\IBM\SPSS\Statistics\23\Samples\English\Employee data.sav'.

## Problem 1

Find the documentation for the FREQUENCIES command. Using a minimum of keywords, write a command that gives you frequency tables of employment category (jobcat), gender (gender), and minority status (minority).

## Problem 2

Find the documentation for the CROSSTABS command. This is a little less straightforward than previous commands, because it has two "modes" of table specification. Which requires less typing (i.e. which requires fewer keywords), general mode or integer mode? (Don't worry too much about what the modes mean for now, just how they are typed differently.)

Using whichever is minimal, write a command that gives you a crosstabulation of employment category and gender. Are there any missing data for either variable? For which combination of categories do we have no observations (note this is different than "missing" data)?

## Problem 3

The dialog box for Analyze - Descriptive Statistics - Explore ... uses the EXAMINE command in the background (the inconsistency in keywords is mildly annoying). Using the dialog box produces verbose syntax, for example:

EXAMINE VARIABLES=salary salbegin
/PLOT BOXPLOT STEMLEAF
/COMPARE GROUPS
/STATISTICS DESCRIPTIVES
/CINTERVAL 95
/MISSING LISTWISE
/NOTOTAL.

Rewrite this command using minimal syntax.

Suppose you were interested in all the statistics, but prefer a histogram. Write a command that gives you that.

## Problem 4

Put the following code in a syntax editor (with the data set opened, too), and try to run it. Look carefully at the error message. What change do you need to make in order to this code to run?

fre var=edu.

A couple of hints: (1) put the syntax in the editor and use the Help (F1) key, (2) abbreviation of most key words is allowed, however, few SPSS programmers write code in this style. Don't bring abbreviated code to me for consulting help!

Last Revised: 27 July 2016