100% found this document useful (2 votes)
96 views50 pages

SPSS Programming and Data Management A Guide for SPSS and SAS Users 3rd Edition Raynald Levesque - Download the ebook now and own the full detailed content

The document provides information on various SPSS programming and data management resources, including links to download multiple ebooks and textbooks. It highlights the 3rd edition of 'SPSS Programming and Data Management: A Guide for SPSS and SAS Users' by Raynald Levesque, which focuses on utilizing SPSS command syntax and Python for data management tasks. Additionally, it includes acknowledgments and a brief overview of the book's contents and structure.

Uploaded by

leelyvolama31
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
96 views50 pages

SPSS Programming and Data Management A Guide for SPSS and SAS Users 3rd Edition Raynald Levesque - Download the ebook now and own the full detailed content

The document provides information on various SPSS programming and data management resources, including links to download multiple ebooks and textbooks. It highlights the 3rd edition of 'SPSS Programming and Data Management: A Guide for SPSS and SAS Users' by Raynald Levesque, which focuses on utilizing SPSS command syntax and Python for data management tasks. Additionally, it includes acknowledgments and a brief overview of the book's contents and structure.

Uploaded by

leelyvolama31
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 50

Download the full version and explore a variety of ebooks

or textbooks at https://ebookultra.com

SPSS Programming and Data Management A Guide for


SPSS and SAS Users 3rd Edition Raynald Levesque

_____ Tap the link below to start your download _____

https://ebookultra.com/download/spss-programming-and-data-
management-a-guide-for-spss-and-sas-users-3rd-edition-
raynald-levesque/

Find ebooks or textbooks at ebookultra.com today!


We have selected some products that you may be interested in
Click the link to download now or visit ebookultra.com
for more options!.

An Intermediate Guide to SPSS Programming Using Syntax for


Data Management 1st Edition Sarah Boslaugh

https://ebookultra.com/download/an-intermediate-guide-to-spss-
programming-using-syntax-for-data-management-1st-edition-sarah-
boslaugh/

A visual approach to SPSS for Windows A guide to SPSS 17 0


2nd, intern. Edition Stern

https://ebookultra.com/download/a-visual-approach-to-spss-for-windows-
a-guide-to-spss-17-0-2nd-intern-edition-stern/

SPSS 16 0 Base User s Guide 1st Edition Inc. Spss

https://ebookultra.com/download/spss-16-0-base-user-s-guide-1st-
edition-inc-spss/

SPSS 14 0 Base User s Guide 1st Edition Inc. Spss

https://ebookultra.com/download/spss-14-0-base-user-s-guide-1st-
edition-inc-spss/
Applied Multivariate Statistics for the Social Sciences
Analyses with SAS and IBM s SPSS 6th Edition Keenan A.
Pituch
https://ebookultra.com/download/applied-multivariate-statistics-for-
the-social-sciences-analyses-with-sas-and-ibm-s-spss-6th-edition-
keenan-a-pituch/

Interpreting Quantitative Data with SPSS 1st Edition


Rachad Antonius

https://ebookultra.com/download/interpreting-quantitative-data-with-
spss-1st-edition-rachad-antonius-2/

Interpreting Quantitative Data with SPSS 1st Edition


Rachad Antonius

https://ebookultra.com/download/interpreting-quantitative-data-with-
spss-1st-edition-rachad-antonius/

IBM SPSS by Example A Practical Guide to Statistical Data


Analysis 2nd Edition Alan C. Elliott

https://ebookultra.com/download/ibm-spss-by-example-a-practical-guide-
to-statistical-data-analysis-2nd-edition-alan-c-elliott/

IBM SPSS for introductory statistics use and


interpretation 4th Edition George A Morgan

https://ebookultra.com/download/ibm-spss-for-introductory-statistics-
use-and-interpretation-4th-edition-george-a-morgan/
SPSS Programming and Data Management A Guide for
SPSS and SAS Users 3rd Edition Raynald Levesque
Digital Instant Download
Author(s): Raynald Levesque, SPSS Inc.
ISBN(s): 9781568273747, 1568273746
Edition: 3rd
File Details: PDF, 2.26 MB
Year: 2006
Language: english
SPSS Programming
and Data Management, 3rd Edition
A Guide for SPSS and SAS® Users

Raynald Levesque and SPSS Inc.


For more information about SPSS® software products, please visit our Web site at http://www.spss.com or contact:

SPSS Inc.
233 South Wacker Drive, 11th Floor
Chicago, IL 60606-6412
Tel: (312) 651-3000
Fax: (312) 651-3668

SPSS is a registered trademark and the other product names are the trademarks of SPSS Inc. for its proprietary computer
software. No material describing such software may be produced or distributed without the written permission of the owners of
the trademark and license rights in the software and the copyrights in the published materials.

The SOFTWARE and documentation are provided with RESTRICTED RIGHTS. Use, duplication, or disclosure by the
Government is subject to restrictions as set forth in subdivision (c) (1) (ii) of The Rights in Technical Data and Computer Software
clause at 52.227-7013. Contractor/manufacturer is SPSS Inc., 233 South Wacker Drive, 11th Floor, Chicago, IL 60606-6412.

General notice: Other product names mentioned herein are used for identification purposes only and may be trademarks of
their respective companies.

SAS is a registered trademark of SAS Institute Inc.


Windows is a registered trademark of Microsoft Corporation. Microsoft® Access, Microsoft® Excel, and Microsoft® Word are
products of Microsoft Corporation.
DataDirect, DataDirect Connect, INTERSOLV, and SequeLink are registered trademarks of DataDirect Technologies.
Portions of this product were created using LEADTOOLS © 1991–2000, LEAD Technologies, Inc. ALL RIGHTS RESERVED.
LEAD, LEADTOOLS, and LEADVIEW are registered trademarks of LEAD Technologies, Inc.
Portions of this product were based on the work of the FreeType Team (http://www.freetype.org).
A portion of the SPSS software contains zlib technology. Copyright © 1995–2002 by Jean-loup Gailly and Mark Adler. The zlib
software is provided “as-is,” without express or implied warranty. In no event shall the authors of zlib be held liable for any
damages arising from the use of this software.
A portion of the SPSS software contains Sun Java Runtime libraries. Copyright © 2003 by Sun Microsystems, Inc. All rights
reserved. The Sun Java Runtime libraries include code licensed from RSA Security, Inc. Some portions of the libraries are
licensed from IBM and are available at http://oss.software.ibm.com/icu4j/. Sun makes no warranties to the software of any kind.
Sax Basic is a trademark of Sax Software Corporation. Copyright © 1993–2004 by Polar Engineering and Consulting. All
rights reserved.

SPSS Programming and Data Management, 3rd Edition: A Guide for SPSS and SAS Users
Copyright © 2006 by SPSS Inc.
All rights reserved.
Printed in the United States of America.

No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any
means—electronic, mechanical, photocopying, recording, or otherwise—without the prior written permission of the publisher.

1 2 3 4 5 6 7 8 9 0 09 08 07 06
ISBN 1-56827-374-6
Preface

Experienced data analysts know that a successful analysis or meaningful report often
requires more work in acquiring, merging, and transforming data than in specifying
the analysis or report itself. SPSS contains powerful tools for accomplishing and
automating these tasks. While much of this capability is available through the
graphical user interface, many of the most powerful features are available only through
command syntax. With release 14.0.1, SPSS makes the programming features of
its command syntax significantly more powerful by adding the ability to combine it
with a full-featured programming language. This book offers many examples of the
kinds of things that you can accomplish using SPSS command syntax by itself and in
combination with the Python programming language.

Using This Book

The contents of this book and the accompanying CD are discussed in Chapter 1. In
particular, see the section “Using This Book” if you plan to run the examples on the CD.
The CD also contains additional command files, macros, and scripts that are mentioned
but not discussed in the book and that can be useful for solving specific problems.
This edition has been updated to include numerous enhanced data management
features introduced in SPSS 14.0. Many examples will work with earlier versions, but
some examples rely on features not available prior to SPSS 14.0. All of the Python
examples require SPSS 14.0.1 or later.

For SAS Users

If you have more experience with SAS than with SPSS for data management, see
Chapter 19 for comparisons of the different approaches to handling various types of
data management tasks. Quite often, there is not a simple command-for-command
relationship between the two programs, although each accomplishes the desired end.

iii
Acknowledgments
This book reflects the work of many members of the SPSS staff who have contributed
examples here and in SPSS Developer Central, as well as that of Raynald Levesque,
whose examples formed the backbone of earlier editions and remain important in
this edition. We also wish to thank Stephanie Schaller, who provided many sample
SAS jobs and helped to define what the SAS user would want to see, as well as
Marsha Hollar and Brian Teasley, the authors of the original chapter “SPSS for SAS
Programmers.”

A Note from Raynald Levesque


It has been a pleasure to be associated with this project from its inception. I have for
many years tried to help SPSS users understand and exploit its full potential. In this
context, I am thrilled about the opportunities afforded by the Python integration and
invite everyone to visit my site at www.spsstools.net for additional examples. And I
want to express my gratitude to my spouse, Nicole Tousignant, for her continued
support and understanding.

Raynald Levesque

iv
Contents

1 Overview 1

Using This Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1


Documentation Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Part I: Data Management

2 Best Practices and Efficiency Tips 5

Working with Command Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5


Creating Command Syntax Files . . . . . . . . ... ... ... ... ... ... ... ... 5
Running SPSS Commands . . . . . . . . . . . . ... ... ... ... ... ... ... ... 6
Syntax Rules . . . . . . . . . . . . . . . . . . . . . . ... ... ... ... ... ... ... ... 7
Customizing the Programming Environment . . ... ... ... ... ... ... ... ... 8
Displaying Commands in the Log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Displaying the Status Bar in Command Syntax Windows . . . . . . . . . . . . . 9
Protecting the Original Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Do Not Overwrite Original Variables. . ... ... ... ... ... ... ... ... .. 11
Using Temporary Transformations . . . ... ... ... ... ... ... ... ... .. 11
Using Temporary Variables . . . . . . . . ... ... ... ... ... ... ... ... .. 12
Use EXECUTE Sparingly . . . . . . . . . . . . . . ... ... ... ... ... ... ... ... .. 14
Lag Functions . . . . . . . . . . . . . . . . . . ... ... ... ... ... ... ... ... .. 14
Using $CASENUM to Select Cases. . . ... ... ... ... ... ... ... ... .. 16
MISSING VALUES Command . . . . . . . ... ... ... ... ... ... ... ... .. 17
WRITE and XSAVE Commands . . . . . . ... ... ... ... ... ... ... ... .. 17
Using Comments. . . . . . . . . . . . . . . . . . . . ... ... ... ... ... ... ... ... .. 17
Using SET SEED to Reproduce Random Samples or Values . . . . . . . . . . . . . . 18

v
Divide and Conquer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Using INSERT with a Master Command Syntax File . . . . . . . . . . . . . . . . 20
Defining Global Settings. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

3 Getting Data into SPSS 23

Getting Data from Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23


Installing Database Drivers . . . . . ... ... ... ... ... ... ... ... ... .. 23
Database Wizard . . . . . . . . . . . . . ... ... ... ... ... ... ... ... ... .. 25
Reading a Single Database Table . ... ... ... ... ... ... ... ... ... .. 25
Reading Multiple Tables. . . . . . . . ... ... ... ... ... ... ... ... ... .. 27
Reading Excel Files. . . . . . . . . . . . . . . ... ... ... ... ... ... ... ... ... .. 30
Reading a “Typical” Worksheet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Reading Multiple Worksheets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Reading Text Data Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Simple Text Data Files . . . . . . . . . . . . . . . ... ... ... ... ... ... ... .. 37
Delimited Text Data . . . . . . . . . . . . . . . . . ... ... ... ... ... ... ... .. 38
Fixed-Width Text Data . . . . . . . . . . . . . . . ... ... ... ... ... ... ... .. 42
Text Data Files with Very Wide Records . . ... ... ... ... ... ... ... .. 47
Reading Different Types of Text Data . . . . ... ... ... ... ... ... ... .. 48
Reading Complex Text Data Files. . . . . . . . . . . ... ... ... ... ... ... ... .. 49
Mixed Files . . . . . . . . . . . . . . ... ... ... ... ... ... ... ... ... ... .. 50
Grouped Files . . . . . . . . . . . . ... ... ... ... ... ... ... ... ... ... .. 51
Nested (Hierarchical) Files . . ... ... ... ... ... ... ... ... ... ... .. 54
Repeating Data . . . . . . . . . . . ... ... ... ... ... ... ... ... ... ... .. 59
Reading SAS Data Files . . . . . . . . ... ... ... ... ... ... ... ... ... ... .. 61
Reading Stata Data Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

vi
4 File Operations 65

Working with Multiple Data Sources. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65


Merging Data Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Merging Files with the Same Cases but Different Variables . . . . . . . . . . 69
Merging Files with the Same Variables but Different Cases . . . . . . . . . . 73
Updating Data Files by Merging New Values from Transaction Files . . . . 77
Aggregating Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Aggregate Summary Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Weighting Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Changing File Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Transposing Cases and Variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Cases to Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Variables to Cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89

5 Variable and File Properties 95

Variable Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Variable Labels . . . . . . . . . . . . . . . . . . . . ... ... ... ... ... ... ... . . 98
Value Labels . . . . . . . . . . . . . . . . . . . . . . ... ... ... ... ... ... ... . . 98
Missing Values . . . . . . . . . . . . . . . . . . . . ... ... ... ... ... ... ... . . 99
Measurement Level . . . . . . . . . . . . . . . . . ... ... ... ... ... ... ... . 100
Custom Variable Properties . . . . . . . . . . . ... ... ... ... ... ... ... . 100
Using Variable Properties As Templates . ... ... ... ... ... ... ... . 102
File Properties . . . . . . . . . . . . . . . . . . . . . . . . ... ... ... ... ... ... ... . 103

6 Data Transformations 105

Recoding Categorical Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105

vii
Banding Scale Variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Simple Numeric Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Arithmetic and Statistical Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
Random Value and Distribution Functions . . . . . . . . . . . . . . . . . . . . . . . . . . 111
String Manipulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Changing the Case of String Values . . ... ... ... ... ... ... ... ... . 113
Combining String Values . . . . . . . . . . ... ... ... ... ... ... ... ... . 113
Taking Strings Apart . . . . . . . . . . . . . ... ... ... ... ... ... ... ... . 114
Working with Dates and Times . . . . . . . . . ... ... ... ... ... ... ... ... . 118
Date Input and Display Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Date and Time Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122

7 Cleaning and Validating Data 129

Finding and Displaying Invalid Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129


Excluding Invalid Data from Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
Finding and Filtering Duplicates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
Data Validation Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136

8 Conditional Processing, Looping, and


Repeating 139

Indenting Commands in Programming Structures . . . . . . . . . . . . . . . . . . . . 139


Conditional Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
Conditional Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
Conditional Case Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
Simplifying Repetitive Tasks with DO REPEAT . . . . . . . . . . . . . . . . . . . . . . . 144
ALL Keyword and Error Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
Vectors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147

viii
Creating Variables with VECTOR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
Disappearing Vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
Loop Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
Indexing Clauses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ... ... ... . 152
Nested Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ... ... ... . 153
Conditional Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ... ... ... . 155
Using XSAVE in a Loop to Build a Data File. . . . . . . . . . . . ... ... ... . 156
Calculations Affected by Low Default MXLOOPS Setting . ... ... ... . 158

9 Exporting Data and Results 161

Output Management System. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161


Using Output as Input with OMS . . . . . . . . . . . . . . . . . . . ... ... ... . 162
Adding Group Percentile Values to a Data File . . . . . . . . . ... ... ... . 162
Bootstrapping with OMS . . . . . . . . . . . . . . . . . . . . . . . . . ... ... ... . 166
Transforming OXML with XSLT . . . . . . . . . . . . . . . . . . . . . ... ... ... . 171
“Pushing” Content from an XML File . . . . . . . . . . . . . . . . ... ... ... . 172
“Pulling” Content from an XML File . . . . . . . . . . . . . . . . . ... ... ... . 175
Positional Arguments versus Localized Text Attributes. . . ... ... ... . 184
Layered Split-File Processing. . . . . . . . . . . . . . . . . . . . . . ... ... ... . 185
Exporting Data to Other Applications and Formats . . . . . . . . . ... ... ... . 186
Saving Data in SAS Format . . . . . . . . . . . . . . ... ... ... ... ... ... . 186
Saving Data in Stata Format. . . . . . . . . . . . . . ... ... ... ... ... ... . 187
Saving Data in Excel Format. . . . . . . . . . . . . . ... ... ... ... ... ... . 189
Writing Data Back to a Database . . . . . . . . . . ... ... ... ... ... ... . 189
Saving Data in Text Format. . . . . . . . . . . . . . . ... ... ... ... ... ... . 192
Exporting Results to Word, Excel, and PowerPoint ... ... ... ... ... ... . 192

ix
10 Scoring Data with Predictive Models 193

Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
Basics of Scoring Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
Command Syntax for Scoring. . . . . . . . . . . . . . . . . . . . . . ... ... ... . 194
Mapping Model Variables to SPSS Variables . . . . . . . . . . ... ... ... . 196
Missing Values in Scoring . . . . . . . . . . . . . . . . . . . . . . . . ... ... ... . 196
Using Predictive Modeling to Identify Potential Customers . . . ... ... ... . 197
Building and Saving Predictive Models . . . . . . . . . . . . . . ... ... .... 197
Commands for Scoring Your Data. . . . . . . . . . . . . . . . . . . ... ... .... 204
Including Post-Scoring Transformations . . . . . . . . . . . . . ... ... .... 205
Getting Data and Saving Results . . . . . . . . . . . . . . . . . . . ... ... .... 206
Running Your Scoring Job Using the SPSS Batch Facility . ... ... .... 207

Part II: Programming with SPSS and Python

11 Introduction 211

12 Getting Started with Python Programming in


SPSS 215
The spss Python Module. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
Submitting Commands to SPSS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
Dynamically Creating SPSS Command Syntax. . . . . . . . . . . . . . . . . . . . . . . 219
Capturing and Accessing Output. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
Python Syntax Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
Mixing Command Syntax and Program Blocks . . . . . . . . . . . . . . . . . . . . . . 224
Handling Errors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227

x
Using a Python IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
Supplementary Python Modules for Use with SPSS . . . . . . . . . . . . . . . . . . 230
Getting Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231

13 Best Practices 233

Creating Blocks of Command Syntax within Program Blocks. . . . . . . . . . . . 233


Dynamically Specifying Command Syntax Using String Substitution . . . . . . 234
Using Raw Strings in Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
Displaying Command Syntax Generated by Program Blocks . . . . . . . . . . . . 238
Handling Wide Output in the Viewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
Creating User-Defined Functions in Python . . . . . . . . . . . . . . . . . . . . . . . . . 239
Creating a File Handle to the SPSS Install Directory . . . . . . . . . . . . . . . . . . 241
Choosing the Best Programming Technology . . . . . . . . . . . . . . . . . . . . . . . 242
Using Exception Handling in Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
Debugging Your Python Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247

14 Working with Variable Dictionary Information 251

Summarizing Variables by Measurement Level . . . . . . . . . . . . . . . . . . . . . . 253


Listing Variables of a Specified Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
Checking If a Variable Exists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
Creating Separate Lists of Numeric and String Variables. . . . . . . . . . . . . . . 257
Using Object-Oriented Methods for Retrieving Dictionary Information. . . . . 258
Getting Started with the VariableDict Class . . . . . . . . . . . . . . . . . . . . . 259
Defining a List of Variables between Two Variables . . . . . . . . . . . . . . . 262
Identifying Variables without Value Labels . . . . . . . . . . . . . . . . . . . . . . 264
Retrieving Definitions of User-Missing Values . . . . . . . . . . . . . . . . . . . 268

xi
Retrieving Variable or Datafile Attributes . . . . . . . . . . . . . . . . . . . . . . . 268
Using Regular Expressions to Select Variables. . . . . . . . . . . . . . . . . . . 271

15 Getting Case Data from the Active Dataset 273

Using the Cursor Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273


Reducing a String to Minimum Length. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
Using the spssdata Module. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
Getting Started with the Spssdata Class. . . . . . . . . . . . . . . . . . . . . . . . 281
Using Case Data to Calculate a Simple Statistic . . . . . . . . . . . . . . . . . . 284

16 Retrieving Output from SPSS Commands 287

Getting Started with the XML Workspace . . . . . . . . . . . . . . . . . . . . . . . . . . 287


Writing XML Workspace Contents to a File . . . . . . . . . . . . . . . . . . . . . 290
Using the spssaux Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291

17 Creating, Modifying, and Saving Viewer


Contents 301
Getting Started with the viewer Module . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
Persistence of Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
Creating a Custom Pivot Table. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304
Modifying Pivot Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
Creating a Text Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
Using the viewer Module from a Python IDE . . . . . . . . . . . . . . . . . . . . . . . . 312

xii
18 Tips on Migrating Command Syntax, Macro,
and Scripting Jobs to Python 313

Migrating Command Syntax Jobs to Python . . . . . . . . . . . . . . . . . . . . . . . . 313


Migrating Macros to Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
Migrating Sax Basic Scripts to Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321

19 SPSS for SAS Programmers 329

Reading Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329


Reading Database Tables ... ... ... ... ... ... ... ... ... ... ... . 329
Reading Excel Files . . . . . ... ... ... ... ... ... ... ... ... ... ... . 332
Reading Text Data . . . . . . ... ... ... ... ... ... ... ... ... ... ... . 334
Merging Data Files . . . . . . . . . ... ... ... ... ... ... ... ... ... ... ... . 334
Merging Files with the Same Cases but Different Variables . . . . . . . . . 335
Merging Files with the Same Variables but Different Cases . . . . . . . . . 336
Aggregating Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337
Assigning Variable Properties. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338
Variable Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
Value Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
Cleaning and Validating Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
Finding and Displaying Invalid Values. . . . . . . . . . . . . . . . . . . . . . . . . . 341
Finding and Filtering Duplicates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
Transforming Data Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344
Recoding Data . . . . . . . . . . . . ... ... ... ... ... ... ... ... ... ... . 344
Banding Data. . . . . . . . . . . . . ... ... ... ... ... ... ... ... ... ... . 345
Numeric Functions . . . . . . . . ... ... ... ... ... ... ... ... ... ... . 347
Random Number Functions . . ... ... ... ... ... ... ... ... ... ... . 348
String Concatenation . . . . . . . ... ... ... ... ... ... ... ... ... ... . 349
String Parsing . . . . . . . . . . . . ... ... ... ... ... ... ... ... ... ... . 350

xiii
Working with Dates and Times . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
Calculating and Converting Date and Time Intervals. . . . . . . . . . . ... . 351
Adding to or Subtracting from One Date to Find Another Date . . . ... . 352
Extracting Date and Time Information . . . . . . . . . . . . . . . . . . . . . ... . 353
Custom Functions, Job Flow Control, and Global Macro Variables. . . . ... . 354
Creating Custom Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
Job Flow Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356
Creating Global Macro Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
Setting Global Macro Variables to Values from the Environment. . . . . . 359

Appendix

A Python Functions 361

spss.CreateXPathDictionary Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362


spss.Cursor Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362
spss.Cursor Methods. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364
spss.DeleteXPathHandle Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
spss.EvaluateXPath Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
spss.GetCaseCount Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
spss.GetHandleList Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
spss.GetLastErrorLevel and spss.GetLastErrorMessage Functions . . . . . . . 369
spss.GetVariableCount Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370
spss.GetVariableFormat Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370
spss.GetVariableLabel Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373
spss.GetVariableMeasurementLevel Function. . . . . . . . . . . . . . . . . . . . . . . 373
spss.GetVariableName Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374
spss.GetVariableType Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374
spss.GetXmlUtf16 Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375

xiv
spss.IsOutputOn Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375
spss.PyInvokeSpss.IsXDriven Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375
spss.SetMacroValue Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376
spss.SetOutput Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
spss.StopSPSS Function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
spss.Submit Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378

Index 381

xv
Exploring the Variety of Random
Documents with Different Content
might offer, could only be partially successful.
Could you earlier in the season have given your wives say a dozen
able-bodied hens apiece, with instructions that they were to be
stimulated to the utmost by their respective owners, the egg-crop
might have assisted very materially in purchasing circus tickets with
the consequent concert tickets and vermilion lemonade.
There are other suggestions that might be made but it is too late
now to make them. I can only offer one more balm to your deeply
wounded and disappointed heart. You might by economy and
frugality, secure an available point on the route with your mass
meeting of household gods and goddesses, where you could sit on
the fence and see the elephant meander by.
Yours, enveloped in a large wad of dense gloom.
THE CROW INDIAN AND HIS CAWS.

E
arly in the week five Crow chiefs passed through here on their
way to Washington.
I went down to see them. They were as fine looking children
of the forest as I ever saw. They wore buckskin pants with overskirt
of same. The hair was worn Princesse, held in place with Frazer's
axle grease and large mother of clamshell brooch. Down the back it
was braided like a horse's tail on a muddy day, only the hair was
coarser.
When an Indian wants to crimp his hair he has to run it through a
rolling mill first, to make it malleable. Then the blacksmith of the
tribe rolls it up over the ordinary freight car coupling pin, and on the
following morning it hangs in graceful Saratoga waves down the
back of the untutored savage.
I said to the interpreter who seemed to act as their trainer, "No
doubt these Crows are going to Washington to try and interest
Hayes in their Caws."
He gave a low, gurgling laugh.
"No," said he with a merry twinkle of the eye, as he laid his lip half
way across a plug of government tobacco, "as spring approaches
they have decided to go to Washington and ransack the Indian
Bureau for their gauzy Schurz."
I caught hold of a car seat and rippled till the coach was filled with
my merry, girlish laughter.
These Indians wear high expressive cheek-bones, and most of
them have strabismus in their feet. They had their paint on. It
makes them look like a chromo of Powhattan mashing the eternal
soul out of John Smith with a Bologna sausage.
One of these chiefs, named Raw-Dog-with-a-Bunion-on the-Heel, I
think, chief of the Wall-eyed Skunk Eaters, looked so guileless and
kind that I approached him and said that no doubt the war-path in
the land of the setting sun was overgrown with grass, and in his
mountain home very likely the beams of peace! lit up the faces of his
tribe.
He did not seem to catch my meaning.
I asked him if his delegation was going to Washington
uninstructed.
In reply he made a short remark something like that which the
shortstop of a match game makes when a hot ball takes him
unexpectedly between the gastric and the liver pad.
Somehow live Indians do not look so picturesque as the steel
engraving does. The smell is not the same, either. Steel engravings
of Indians do not show the decalcomania outline of a frying-pan on
the buckskin pants where the noble red man made a misstep one
morning and sat down on his breakfast.
A dead Indian is a pleasing picture. The look of pain and anxiety is
gone, and rest, sweet rest—more than he really needs—has come at
last. His hands are folded peacefully and his mouth is open, like the
end of a sawmill. His trials are o'er. His swift foot is making pigeon-
toed tracks in the shifting sands of eternity.
The picture of a wild free Indian chasing the buffalo may suit
some, but I like still life in art. I like the picture of a broad-
shouldered, well-formed brave as he lies with his nerveless hand
across a large hole in the pit of his stomach.
There is something so sweetly sad about it. There is such a
nameless feeling of repose and security on the part of the spectator.
Some have such sensitive natures that they cannot look at the
remains of an Indian who has been run over by two sections of
freight, but I can. Somehow I do not feel that nervous distrust when
I look at the red man with his osophagus wrapped around his head
and tied in a double bow knot, that I do when he is full of the vigor
of health.
When a train of cars has jammed his thigh-bone through his
diaphragm and flattened his head out like a soup plate, I feel then
that I can trust him. I feel that he may be relied upon. I consider
him in the character of ghastly remains as a success. He seems at
last so in earnest and as though he could be trusted.
When the Indian has been mixed up so that the closest scrutiny
cannot determine where the head adjourns and the thorax begins,
the scene is so suggestive of unruffled quiet and calm and gentle
childlike faith that doubt and distrust and timidity and apprehension
flee away.
THE NUPTIALS OP DANGEROUS
DAVIS.

O
n the morning on which Adam Forepaugh entered the city of
Laramie, and with a grand array of hump-backed
dromedaries, club-footed elephants, and an uncalled-for
amount of pride, and pomp, and circumstance, captured the town,
Dangerous Davis, clad in buckskin and glass beads, and ornamented
with one of Smith & Wesson's brass-mounted, self-cocking, Black
Hills bustles, entered his honor's office, and walking up to the
counter where the Judge deals out justice to the vagabond
tenderfoot, and bankrupt non resident, as well as to the law-defying
Laramite, called for $5.00 worth of matrimony.
On his arm leaned the fair form of the one who had ensnared the
heart of the frontiersman, and who had evidently gobbled up the
manly affections of Dangerous Davis. She was resplendent in new
clothes, and a pair of Indian moccasins, and when she glided up to
the centre of the room, the casual observer might have been
deceived into the belief that she was moving through the radiant
atmosphere like an $11.00 Peri, if it had not been for the gentle
patter of her moccasin as it fell upon the floor with the sylph-like
footfall of the prize elephant as he moves around the ring to the
dreamy strains of "Old Zip Coon." A large "filled" ring gleamed and
sparkled on her brown hand, and vied in splendor with a large seed-
wart on her front finger. The ends of her nails were draped in the
deepest mourning, and as she leaned her head against the off
shoulder of Dangerous Davis, the ranche butter from her tawny
locks made a deep and lasting impression on his buckskin bosom.
At this auspicious moment His Honor entered the room, with a
green covered German almanac for 1852 and a copy of Robinson
Crusoe under his arm, and as he saw the young thing who was
about to unite herself to the bold, bad man from Bitter Creek, he
burst into tears, while Judge Blair, who had adjourned the District
Court in order to witness the ceremony, sat down behind the stove
and sobbed like a child. At this moment William Crout, who has been
married under all kinds of circumstances and in eleven different
languages, entered the room and inspired confidence in the weeping
throng.
Dangerous Davis changed his quid of tobacco from one side of his
amber mouth to the other, spat on his hands, and asked to see the
Judge's matrimonial price list. The Judge showed him some different
styles, out of which Dangerous Davis selected the kind he wanted.
By this time about one hundred and thirteen men, who had been
waiting around the court room during the past week in order to be
drawn as jurymen, had crowded in to witness the ceremony.
After all the preliminaries had been gone through with, the Judge
commenced reading the marriage service out of a copy of the
Clown's Comic Song Book. When he asked if anyone present had
any objections to the proceedings, Price, from force of habit, rose
and said, "I object;" but Dangerous Davis caressed his brass-
mounted Grecian bend, and Price withdrew the objection. Everybody
admitted Price's good judgment, under the circumstances, in
withdrawing the objection.
After the usual ceremony, the Judge put the bridegroom through
some little initiations, instructed him in the grand hailing signs, grips,
passwords and signals, swore him to support the Constitution of the
United States, pronounced the benediction on the newly-wedded
pair, and the ceremony closed with an extemporaneous speech by
Judge Brown and profound silence and thoughtfulness on the part of
Brockway, as he reflected upon the dangers which constantly
surround us.
Dangerous Davis mounted his broncho, and tying his new wife on
behind him on the saddle with an old shawl strap, plunged his spurs
into the panting sides of his calico colored steed, and in a few
moments was flying over the green plains, while the mountain
breeze caught up the oleaginous saffron-hued tresses of the bride
and in wild glee mingled them with the broncho's sorrel tail, and
tossed them to the four winds of heaven.
THE HOLIDAY HOG.

D
ear reader, did you ever go along past the market these cold
December mornings and study the expression of the frozen
holiday hog as he stands at the door with his mouth propped
open by a chip, and the last hardened outlines of a diabolical smile
lingering about the whole face? Did it ever occur to you that he has
ways like Charles Francis Adams?
And yet he was not always thus—a cold, hard, immovable pork
statue. Once he was the pride of some Nebraska home. He was
petted and caressed no doubt, and had more demoralized melon
rinds, and cold potatoes, and dish water than he actually needed.
But think of it, gentle, kind-hearted reader; he has been torn from
those he loved, and butchered to make a Caucasian holiday;
snatched from the home of his youth, and frozen into a double and
twisted post mortem examination. Perhaps, dear reader, you have
never had to stand as a model for the picture of the man in the front
of the almanac, who looks like the victim of a buzz saw, with the
various members of the Zodiac family floating around him. If you
have not, and we will take your word for it, you cannot fully realize
the feelings of the Nebraska hog on a December day, without a
stitch of clothes to his back.
SOME CENSUS CONUNDRUMS.
It was in the prime of summer time,
An evening calm and cool—

W
hen the census enumerator came to the sanctity of my
home, and opened a valise which contained a large
duodecimo volume, and about nine gallons of brand new
interrogation points.
He opened his note book, which was about the size of the White
River Reservation, and proceeded to get acquainted. I thought at
first that he had come from Chicago to interview me about the
Presidential convention, and get my views. This was not the case,
however.
I think he is going to write my biography and sell it at $2.00 each.
I gave him all the information I could, and telegraphed to my old
Sabbath School Superintendent at home for more.
Among other little evidences of his morbid curiosity, I will give the
following:
When were you born, and looking calmly back at this important
epoch in your life, do you regret that you took the step?
If yes, state to what extent and under what circumstances?
Do you remember George Washington, and if so to what amount?
What is your fighting weight?
Who struck Billy Patterson?
Did you ever have membranous croup, and what did you do for it?
Do you keep hens, or do you lavish your profanity on those of
your neighbors?
Have any of your ancestors ever been troubled with ingrowing
nails, or blind staggers?
What is your opinion of rats?
Are you a victim to rum or other alcoholic stimulants, and if so, at
what hour do you usually succumb to the potent enemy?
Would you have any scruples in asking the enumerator to join you
in wrestling with man's destroyer at that hour?
Do you eat onions?
Which side do you lie on while sleeping?
Which side do you lie on during a political campaign?
What is the chief end of man?
Are you single, and if so what is your excuse? Who will care for
mother now?
THE GENTLE POWER OF A WOMAN'S
INFLUENCE.

C
ummins City is still a crude metropolis. Society has not yet
arrived at the white vest and lawn sociable period there.
There is nothing to hamper any one or throw a tiresome
restraint around him. You walk up and down the streets of the camp
without feeling that the vigilant eye of the policeman is upon you,
and when you register at the leading hotel the proprietor don't ask
how much baggage you have, or insist upon it that your valise ought
to be blown up with a quill to give it a robust appearance.
Speaking of this hotel, however, brings to my mind a little incident
which really belongs in here. There are two ladies at this place, the
only ones in the city limits, if my memory serves me. One of these
ladies owns a lot of poles or house logs which were, at the time of
which I speak, on the dump, as it were, ready to be used in the
construction of a new cabin.
It seems that some of the prospectors of the corporation, without
the fear of God or the Common Council of Cummins City, had been
appropriating these logs from time to time until out of a good, fair
assortment there remained only a dejected little pile of "culls." The
owner had watched with great annoyance the gradual disappearance
of her property from day to day, and it made her lose faith in the
final redemption of all mankind. She became cynical and
misanthropical, lost her interest in the future, and became low
spirited and unhappy.
One day, however, after this thing had proceeded about far
enough she went to her trunk, and taking out the large size of navy
revolver, the kind that plows up the vitals so successfully and sends
so many Western men to their long home. Then she went out to
where a group of men had scattered themselves out around camp to
smoke.
She wasn't a large woman at all, but these men respected her.
Though they were only rough miners there in the wilderness they
recognized that she was a woman, and they recognized it almost at
a glance, too. There she was alone among a wild group of men in
the mountains, far from the protecting arm of the law and the
softening influences of metropolitan life, and yet the common feeling
of gallantry implanted in the masculine breast was there.
She indicated with a motion of her revolver that she desired to call
the meeting to order. There seemed to be a general anxiety on the
part of every man present to come to order just as soon as
circumstances would permit. Then she made a short speech relative
to the matter of house logs, and suggested that unless a certain
number of those articles, now invisible to the naked eye, were
placed at a certain point, or a certain amount of kopecks placed on
file with the chairman of the meeting within a specified time, that
perdition would be popping on Main Street in about two and one-
half ticks of the chronometer.
There didn't seem to be any desire on the part of the meeting to
amend the motion or lay it on the table. Although it was arbitrary
and imperative, and although an opportunity was given for a free
expression of opinion, there didn't seem to be any desire to take
advantage of it.
A committee of three was appointed to carry out the suggestions
of the chair, and in about half an hour, the house logs and kopecks
having been placed on deposit at the places designated, the meeting
broke up, subject to the call of the chairman.
It was not a very long session, but it was very harmonious—very
harmonious and very orderly. There was no calling for the previous
question or rising to a point of order. The pale-faced men who
composed the convention did not look to the casual observers as
though they had come there to raise points for debate over
parliamentary practice. They kept their eye on the speaker's desk
and didn't interrupt each other or struggle to see who would get the
floor.
It is wonderful this inherent strength of weakness, as I might say,
which enables a woman amid a throng of reckless men to command
their respect and obedience sometimes where main strength and
awkwardness would not avail.
THE NATIVE INBORN
SHIFTLESSNESS OF THE PRAIRIE
DOGS.

I
had read in my Fourth Reader about prairie dogs, and I thought,
according to Washington Irving, that they knew more than a
Congressman. He says a great deal about the sagacity and
general mental acumen of the prairie dog, but I don't just exactly
somehow seem to see where it comes in.
If it be an indication of shrewdness and forethought to establish a
village nine hundred miles from a railroad, wood, water and grub,
and live on alkali and moss agates and wander down the vista of
time without a square meal, then the prairie dog is beyond the
barest possibility of doubt, keen and shrewd to a wonderful degree.
But if instinct or animal sagacity be reckoned according to the
number and amount of creature comforts afforded within a given
space, I have a cow in my mind that will double discount all the
chuckle-headed, cactus eating prairie dogs west of the Missouri.
I do not wish to say anything relative to Mr. Irving's opinion of the
prairie dog which would not be perfectly respectful, for I learn with
great sorrow that Mr. Irving is dead, but I do think that there is
hardly an animal in the entire arcana of nature that will not beat the
prairie dog two to one as a provider for his family or himself.
I have an old hen at my home here who certainly approximates
very closely to my ideal of an irreclaimable fool that has grown
childish with old age, and outside of the Democratic party perhaps
she is entitled to distinction. But even she has lucid intervals, and
she hasn't yet fallen to where she would willingly take up a home
under the desert land act like a prairie dog.
ANSWERS TO CORRESPONDENTS.

T
he following answers to correspondents contain a great deal of
useful information, and I publish them in order to avoid the
constant annoyance of writing the same in substance to so
many inquiring friends.
"Sweet Sixteen" writes from "Hold-up Hollow."
I am betrothed to a noble youth from Rice Lake, Minnesota, but
he seems too have soured on his betroth.
"At first he seemed to love me according to Gunter, but he has
grown cold. About the first of the round-up he went away, and I
soon afterward heard that he was affianced to another.
"I understand that he says I am not of noble lineage enough for
him. It is true. I may not be a thorough-bred, but I have a pure,
loving nature, which is now running to waste. The name of my
beloved is De Courtney Van D'Edbeete. He comes from the first
families, and O, I love him so!
"Can you tell me what to do?
"Sweet Sixteen."
Answer.—Yes, I can tell you what to do. I have been there some,
too. If you will only do as I tell you, you are safe.
You must win him back. I think you can easily do so.
Select a base-ball club of about the weight you can handle easily,
and then go to him and win him back.
You are too prone to give up easily. Do not be discouraged.
All will yet be well.
He may think now that you are not of noble blood but you can
make him change his mind. Go to him with the love light in your eye
and put a triangular head on him with your base-ball club, and tell
him that he does not understand the cravings of your nature. Drive
him into the ground and sit down on him, and then tell him that you
are nothing but a poor, friendless girl, and need some one to cling
to. Then you can cling to him. All depends upon how successful you
are as a clinger.
I see at a glance that De Courtney needs to be flattened out a few
times. Do not kill him, but bring him so near to the New Jerusalem
that he can see the dome of the court house, and he will gradually
come back to you and love you, and your life will be one long golden
dream of never-fading joy, and De Courtney will wring out the
colored clothes for you and help you do the washing, and he will
stay at home evenings and take care of the children while you go to
prayer meeting, and he will not murmur when you work off an
inexpensive meal of cold rice and fricasseed codfish on him.
If he gets to feeling independent, and puts on the old air of
defiance, you can diet him on cold mush and mackerel till he will not
feel so robust, and then you can reason with him again, and while
he is recovering you can take your baseball club and your noble self-
sacrificing love, and win him back some more.
"Lalla Rookh" writes from Waukegan, Illinois, as follows to wit:
"My classmates and I have had quite a serious discussion recently,
on several questions of table etiquette, and we have finally agreed
to leave the matter with you.
"First—If one is asked to say grace at the table, and does not wish
to do so, or is not familiar with the forms, what should he do?
"Second—If one has anything in his mouth, or gets any foreign
substance like a piece of bone or a seed in his mouth, how should
he remove it, and what is the proper thing to do with it?
"Third—Would you kindly add a few general rules of table
etiquette, which would be useful to the many admirers of your
classic style?"
Answer—It would be hazardous for a gentleman unaccustomed to
asking grace at the table to attempt it, unless he be a naturally
fluent extemporeaneous speaker.
It is more difficult for one unacquainted with it, than to address a
Sabbath school, or write a letter accepting the nomination for
President.
It is, therefore, preferable to say in a few terse remarks that you
are profoundly grateful for the high compliment, but that your health
will not admit of its acceptance.
Second—Care should be used while at table not to get large
foreign substances like hair-pins, soup-bones, or clothespins into the
mouth with food, as it naturally requires some little sang froid and
tact to remove them. One accustomed to the mysteries of parlor-
magic may slide the articles into his sleeve while coughing, and
thence into the coat pocket of his host, thus easily getting himself
out of an unpleasant situation, and at the same time producing roars
of laughter at the expense of the host.
If, however, you are not familiar with sleight of hand, you may
take in a full breath, and expel the object across the room under the
whatnot, where it will not be discovered until you have gone away.
I will add a few general rules for table etiquette, which I have
learned by actual experience to be of untold benefit to the active
society man.
First—It is proper to take the last of anything on the plate if it
comes to you, instead of declining it. It is supposed that there is
more in the house, or if not, the host may go down town and get
some. Do not, therefore, decline anything because it is the last on
the dish, unless it looks as though it wouldn't suit you.
Second—If by mistake you get your spoon in the gravy so far that
the handle is more or less sticky, do not get ill-tempered or show
your displeasure, but draw it through your mouth two or three
times, laughing a merry laugh all the time. Do not attempt to polish
it off with your handkerchief. It might spoil your handkerchief.
Third—In drinking wine at table do not hang your eyes out on
your cheek, or drink too fast and get it up your nose.
Do not drain your glass perfectly dry and then try to draw in what
atmosphere there is in the room. This is not only vulgar, but it tends
to cast large chunks of three-cornered gloom over the guests.
When you have drained your glass, do not bang it violently on the
table and ask your host "how much he is out." This gives too much
of the air of wild, unfettered freedom, and the unrestrained hilarity
of the free-lunch.
Fourth—When you get anything in your mouth that is too hot, do
not get mad and swear, because the other guests will only laugh at
you, but remove the morsel calmly and tell the waiter to put it on ice
a little while for you.
Fifth—When your coffee is out and you desire more, do not pound
on your cup with your spoon, but be gentle and ladylike in your
demeanor, telling some fresh little anecdote to please the guests,
looking yearningly toward the coffee urn all the while.
Sixth—If you have to leave the table as soon as you are through,
do not jump up suddenly and upset the table, but make an original
and spicy remark about "having to eat and run like a beggar," and
this will create such a hearty laugh over your sally of wit that you
can slip out, select the best hat in the hall, and be half way home
before the company can restrain its mirth.
There are some more good rules that I have on hand, not only
relative to the table, but the ball-room, the parlor, the croquet lawn,
the train, the church, and, in fact, almost everywhere that the
society man might be placed. These I will give the public from time
to time, as the growing demand seems to dictate.
THE SECRET OF GARFIELD'S
ELECTION.
Headquarters in the Field,}
September 19, 1880.}

A
s I start for Chicago to-morrow I take this opportunity to
write.
The trip so far has been one continuous ovation. I have
been swinging round the circle, leaving the flag and the constitution
with the people, and living out of a valise—and my friends—till I
begin to yearn for home. It has been my fortune to run into several
Garfield meetings during the time that I have been here, and to
make short but telling speeches for the Republican candidates. As
one of the local papers very truthfully said:
"Mr. Nye certainly reaches the very core of the subject matter in
his admirable campaign speeches this fall. His commanding
appearance and wild, peculiar beauty win the attention of the
audience even before he says one word, and when speaking his air
of candor and searching truth secures the earnest and prayerful
consideration of those before him. He seems to supply a want long
felt, and in case of Garfield's election we have no hesitation in saying
that it will be due largely to the scorching truths and heaven-born
genius of this remarkable man."
It is a novel sensation indeed, after five years of silent suffering in
Wyoming, disfranchised and helpless, to mingle in the campaign and
give free utterance to the blood-curdling truths that have for years
been bottled up in these brain. Perhaps the people here do not
deserve it, but they need purification through suffering.
I have one Garfield speech that I have used here a number of
times with telling effect, and which I shall turn over to the State
Central Committee when I go West.
By taking out the front breadths, turning the overskirt and revising
the peroration, it will wear till November easily. I would insert it in
this letter only for the fact that it seems rather tame in print, owing
to the absence of gestures.
In my public speaking most everyone who is near me seems to be
forcibly struck with my gestures. Hear what the press says. The
Minneapolis Tribune, speaking of my wonderful effort, concludes as
follows:
"Perhaps the most potent weapon of this campaign is the
soothing, poetical style of gesture owned and operated by William
Nye. In his speech last evening before the Young Men's Republican
club, those who were on the fence were harassed with soul-
destroying doubts as to which was most to be feared, the success of
an unprincipled Democracy or the frolicsome gestures of the
speaker. The general feeling at the close of the speech seemed to be
that Minneapolis had never listened to a speech so rich with wild,
impetuous and death-dealing gesticulations before."
The Stillwater Lumberman says:
"The speech last evening was noticeable for its grandeur of
conception and the picturesque grace of its calisthentics. The
speaker seemed to be largely made up of massive brow and limbs.
When he rose and with easy grace unrolled his speech and
untangled his legs, a general smile seemed to ripple the faces of the
immense audience, but when he took a drink of water and began to
make his new style of gesture, the mirthful manifestations gave
place to a horrible apprehension of danger. Toward the close of the
speech when Mr. Nye got warmed up to his work, and seemed to be
lost in a wilderness of dissolving limbs, the police interfered and
prevented the sacrifice of human life."
The Clear Lake News of the 17th says:
"One of the distinguishing features of the meeting held here on
Wednesday evening, under the management of the Temple of Honor,
was a short speech on temperance by Bill Nye, of Wyoming.
"His work in the line of temperance seems to have been mainly
that of furnishing the horrible examples, so that young men might
avoid the demon of rum.
"After the speaker got well under way and began to emphasize his
language with some gestures that he has imported at great expense
for his own use, the congregation seemed at a loss whether it would
be best as a matter of safety to flee from intemperance or the
death-dealing gestures of the speaker.
"Mr. Nye to-day gave bonds in the sum of $500 to keep the peace,
shipped his gestures to Chicago, and will leave on the first south-
bound train."
PERILS OF THE BUTTERNUT
PICKER.

S
peaking of trains reminds me that I have been scooting around
the country lately on mixed and accommodation trains.
They are a good style of conveyance in some respects. For
instance, if a man has a car-load of wheat that he wants to run into
St. Paul with and sell, he can have it attached to the mixed train,
and then he can get into the coach and go along with it, and attend
to it personally. But where a man's time is worth $9 a moment, as
mine is, it is annoying.
At first I couldn't get accustomed to it. I couldn't overcome my
inertia when the car started or stopped, and it kept me worn out all
the time apologizing to a corpulent old lady in the third seat from
me. Had I been given a little time to select a lady whose lap I would
prefer to sit down in, there were a dozen perhaps in the car more
desirable than this old lady, but in the hurry and agitation I always
seemed to select her.
Finally the conductor said that kind of business had gone far
enough, and he tied me into my seat with a shawl-strap.
The train was very long, and when it got under full head-, way it
was almost impossible to stop it at the various stations. We either
stopped out in the country prematurely or passed the station at the
rate of nine miles a minute, and then repented and came back. I
was struck with the similarity of the first five or six towns on the line
and spoke of it to a friend who accompanied me.
It seemed to me that Clarksville, Mapleton, Eldorado Junction,
Pine Grove and Brookville had been planned by the same architect,
but my friend only laughed and showed me that we had been
switched and side-tracked for two or three hours at the first-named
place.
We stopped in the woods once and I went out after butternuts.
It was a lovely autumn day, and after the thick nutritious air of the
car, it was paradise to get out into the forest, where the fresh, sweet
odor of the falling leaves was everywhere, and the hush of nature's
annual funeral checked the thoughtless word and noisy laughter of
the invader.
I wandered on, thinking of the brevity and comparative
unimportance of our human life. How short the race we run, and
how unsatisfactory our achievements at last. How like the leaves of
the forest we spring forth in the early summer of our existence, nod
pleasantly to our fellows a few brief mornings, and then die.
Thoughtlessly and aimlessly I had wandered on until I came to a
large butternut, which I climbed with the old and almost forgotten
enthusiasm of boyhood. At the top I tried some of my old and
difficult tricks, and just as the train moved silently away I was going
through the difficult and dangerous act of hanging to the upper limb
of a butternut tree by the seat of the pants, and waiting patiently for
the bough or the cassimere to yield and let the artist down into the
arena by force of gravitation.
Dear reader, did you ever go through this thrilling experience? Did
you ever feel the utter insecurity and maddening uncertainty which it
yields? If not, then these lines are not to you?
Gently the tree swayed to and fro with the motion of the autumn
breeze. Sadly the pines were sighing like lost souls, and the dead
leaves fell softly to the ground, like the footfalls of departed spirits. I
began to wish that I could fall softly to the ground like the footfalls
of departed spirits, too.
I began to get bored and unhappy after awhile. My feet and hands
hung in a cluster, and the position seemed strained and unnatural. I
began to yearn for society, and the comforts of a home. I mentally
calculated the distance I would have to fall, and wondered which of
my bones I would shatter the most, and what the doctor's bill would
be.
All at once I heard what seemed like a sound of smothered
laughter. It was no doubt nothing but a sound which my fevered
imagination had conjured up, aided by the torrent of blood that
rushed to my head and thumped so loudly in my ears, but it
maddened me, and I summoned all my strength in the mighty
struggle to free myself. Finally, there was a short, sharp crash, and I
felt myself rapidly descending through space. I fancied that I was an
acrobat, and had fallen from the center pole that holds up the sky. I
thought I lay in the dust and sawdust of the ring in a shapeless
mass; and over all, and above all, there was the maddening
sensation that my wardrobe was not complete. In my tortured
imagination I could hear demoniac laughter, and occasional words of
derision. They became more pronounced and distinct at last, and I
fancied I heard one of these grinning imps saying:
"How peaceful he looks, and how young and fair. See how
carelessly he has inserted his nose in the moist earth. He must have
suffered a good deal through life, and yet his face is calm and happy
in its expression. His general appearance is that of perfect rest, and
the glad fruition of every hope.
"Let us go up into the tree and get the rest of his remains, and
send them all home together."
This last speaker reminded me of the conductor, and the similarity
struck me even in my trance. Slowly I opened my eyes. It was he. I
almost wished that the fall had killed me. I did not fall from the tree
to be humorous, but if I had I should have considered it the
crowning triumph of an eventful career.
Most everyone from the train was there, and several from the
nearest towns along the line. I bowed my thanks in silence, and
backed over to the car. I got aboard and sat down. I found that I
attracted less attention when I was sitting down, and I never cared
so little for public notice in my life as I did that day.
It seems that the train had gone away some distance, but when it
got by itself it remembered that I was not on board, and the peanut
boy remembered seeing me get off at this point. So, as the train was
already two weeks and four days behind, the conductor decided to
go back. He says now that he does not regret it. He says that the life
of a conductor at the best has but few bright spots in it, and the
oases along the desert which he treads are widely separated, but he
told me with tears in his eyes that Providence had made me the
humble instrument for great good, and he felt grateful to me.
When he breaks out into a glad ripple of childish laughter now
without any apparent cause, he takes a piece of checked cassimere
out of his pocket and explains how he got it, and tells the whole
story to his friends, so there are a great many people along that line
of travel who know me by reputation although they have never seen
me.
A WORD OR TWO ABOUT THE
SWALLOW.

L
ately I have made some valuable discoveries relative to
ornithology, and I will give some of them to the public, for I
love to shed information right and left, like a Normal school.
When the soft south wind began to kiss our cheeks, and the
horse-radish and North Park prospector began to start, the swift-
winged swallows drew near to my picturesque home on East Fifth
street, and I hoped with a great, anxious, throbbing hope, that they
would build beneath the Gothic eaves of my $200 ranche.
I would take my guitar at the sunset hour, and sit at my door in a
camp-chair, with the fading glory of the dying day bathing me in a
flood of golden light, and touching up my chubby form, and I would
warble, "When Sparrows Build," an old solo in J, which seems to fit
my voice, and the swallows would flit around me on tireless wing,
and squeak, and sling mud over me till the cows came home.
This thing had gone on for several days, and the little mud houses
under the eaves were pretty near ready, and in the meantime the
spring bed bug had come with his fragrant breath, and turpentine,
and quicksilver, and lime, and aquafortis, and giant-powder, and a
feather, has made my home a howling wilderness, that smelled like a
city drug store.
But it didn't kill the bugs. It pleased them. They called a meeting
and tendered me a vote of thanks for the kind attentions with which
they had been received. They ate all these diabolical drugs, not only
on regular days, but right along through Lent.
I got mad and resolved to insure the house and burn it down. One
evening I felt sad and worn, and was trying to solace myself by
trilling a few snatches from Mendelssohn's "Wail," written in the key
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookultra.com

You might also like