- Page 1 and 2: SPSS Programmingand Data Management
- Page 3 and 4: PrefaceExperienced data analysts kn
- Page 5 and 6: Contents1 Overview 1UsingThisBook..
- Page 7 and 8: 4 File Operations 62WorkingwithMult
- Page 9 and 10: CreatingVariableswithVECTOR .......
- Page 11 and 12: MixingCommandSyntaxandProgramBlocks
- Page 13 and 14: 17 Creating Procedures 327GettingSt
- Page 15 and 16: TransformingDataValues.............
- Page 17: spss.StartSPSSFunction ............
- Page 20 and 21: 2Chapter 1• \examples\data contai
- Page 22 and 23: Chapter2Best Practices and Efficien
- Page 24 and 25: 6Chapter 2Figure 2-1Command syntax
- Page 26 and 27: 8Chapter 2Figure 2-2Log with and wi
- Page 28 and 29: 10Chapter 2Do Not Overwrite Origina
- Page 30 and 31: 12Chapter 2BEGIN DATA1 2 3 4 5END D
- Page 34 and 35: 16Chapter 2MISSING VALUES CommandIf
- Page 36 and 37: 18Chapter 2• Thesecondtimethedata
- Page 38 and 39: 20Chapter 2ExampleYou can create a
- Page 40 and 41: GettingDataintoSPSSChapter3Before y
- Page 42 and 43: 24Chapter 3• Table joins are not
- Page 44 and 45: 26Chapter 3GET DATA /TYPE=ODBC /CON
- Page 46 and 47: 28Chapter 3GET DATA /TYPE=ODBC/CONN
- Page 48 and 49: 30Chapter 3treating the Excel workb
- Page 50 and 51: 32Chapter 3• The original data ty
- Page 52 and 53: 34Chapter 3GET DATA/TYPE=ODBC/CONNE
- Page 54 and 55: 36Chapter 3applications export text
- Page 56 and 57: 38Chapter 3• If all of the variab
- Page 58 and 59: 40Chapter 3CSV Delimited Text Files
- Page 60 and 61: 42Chapter 3You could define the sam
- Page 62 and 63: 44Chapter 3• The first forward sl
- Page 64 and 65: 46Chapter 3*wide_file.sps.*Read tex
- Page 66 and 67: 48Chapter 3• Although the third c
- Page 68 and 69: 50Chapter 3ExampleIn this example,
- Page 70 and 71: 52Chapter 3RECORD=6 CASE=student 1-
- Page 72 and 73: 54Chapter 3• The value that ident
- Page 74 and 75: 56Chapter 3the last value instead o
- Page 76 and 77: 58Chapter 3Repeating DataIn a repea
- Page 78 and 79: 60Chapter 3*get_sas.sps.GET SAS DAT
- Page 80 and 81: File OperationsChapter4You can comb
- Page 82 and 83:
64Chapter 4DATA LIST FREE /file1Var
- Page 84 and 85:
66Chapter 4Merging Data FilesYou ca
- Page 86 and 87:
68Chapter 4ExampleExpanding the pre
- Page 88 and 89:
70Chapter 4DATASET NAME household.D
- Page 90 and 91:
72Chapter 4DATASET NAME retail.***s
- Page 92 and 93:
74Chapter 4Figure 4-5Cases added in
- Page 94 and 95:
76Chapter 4Aggregating DataThe AGGR
- Page 96 and 97:
78Chapter 4• As with the previous
- Page 98 and 99:
80Chapter 4• The DO IF structure
- Page 100 and 101:
82Chapter 4Transposing Cases and Va
- Page 102 and 103:
84Chapter 4cases, you may not be ab
- Page 104 and 105:
86Chapter 4Figure 4-13Data file aft
- Page 106 and 107:
88Chapter 4Figure 4-15Data file aft
- Page 108 and 109:
90Chapter 4Figure 4-17Related varia
- Page 110 and 111:
92Chapter 5Interview_date "Intervie
- Page 112 and 113:
94Chapter 5• User-defined missing
- Page 114 and 115:
96Chapter 5VARIABLE LEVELIncome_cat
- Page 116 and 117:
98Chapter 5• Attribute names that
- Page 118 and 119:
100Chapter 5Figure 5-4File properti
- Page 120 and 121:
102Chapter 6• ELSE = COPY retains
- Page 122 and 123:
104Chapter 6Figure 6-2Make Cutpoint
- Page 124 and 125:
106Chapter 6EXECUTE.• COMPUTE var
- Page 126 and 127:
108Chapter 6- COMPUTE Poisson_Distr
- Page 128 and 129:
110Chapter 6• The COMPUTE command
- Page 130 and 131:
112Chapter 6• For tel2, SUBSTR(#t
- Page 132 and 133:
114Chapter 6• COMPUTE #n... then
- Page 134 and 135:
116Chapter 6• Months can be repre
- Page 136 and 137:
118Chapter 6• Conversion function
- Page 138 and 139:
120Chapter 6Example*datediff.sps.DA
- Page 140 and 141:
122Chapter 6/StartDateTime (datetim
- Page 142 and 143:
124Chapter 7- ELSE IF gender = 1.-
- Page 144 and 145:
126Chapter 7Excluding Invalid Data
- Page 146 and 147:
128Chapter 7• Although MATCH FILE
- Page 148 and 149:
130Chapter 7• COMPUTE filtervar=(
- Page 150 and 151:
132Chapter 7Figure 7-5Results from
- Page 152 and 153:
134Chapter 8Conditional ProcessingC
- Page 154 and 155:
136Chapter 8Missing Values in DO IF
- Page 156 and 157:
138Chapter 8• The COMPUTE command
- Page 158 and 159:
140Chapter 8DO REPEAT v=var1 TO var
- Page 160 and 161:
142Chapter 8***real job starts here
- Page 162 and 163:
144Chapter 8*Vector vec no longer e
- Page 164 and 165:
146Chapter 8• LOOP IF continues a
- Page 166 and 167:
148Chapter 8• The VECTOR command
- Page 168 and 169:
150Chapter 8LOOP.- COMPUTE Z=Z+1.EN
- Page 170 and 171:
152Chapter 8Figure 8-7Tabular sourc
- Page 172 and 173:
154Chapter 8Figure 8-8Different res
- Page 174 and 175:
156Chapter 9Using Output as Input w
- Page 176 and 177:
158Chapter 9Figure 9-1Default and p
- Page 178 and 179:
160Chapter 9Figure 9-3Percentiles a
- Page 180 and 181:
162Chapter 9Figure 9-4Variables dim
- Page 182 and 183:
164Chapter 9values of the bootstrap
- Page 184 and 185:
166Chapter 9• All of the XSLT sty
- Page 186 and 187:
168Chapter 9  Page Title
- Page 188 and 189:
170Chapter 9Although you can easily
- Page 190 and 191:
172Chapter 9CategoryCountPercent
- Page 192 and 193:
174Chapter 9Figure 9-11XPath expres
- Page 194 and 195:
176Chapter 9Figure 9-13Main templat
- Page 196 and 197:
178Chapter 9• calls another temp
- Page 198 and 199:
180Chapter 9Figure 9-15Rounding cel
- Page 200 and 201:
182Chapter 9Exporting Data to Other
- Page 202 and 203:
184Chapter 9SPSS Variable Type Stat
- Page 204 and 205:
186Chapter 9• You can use APPEND
- Page 206 and 207:
188Chapter 9• The TABLE subcomman
- Page 208 and 209:
190Chapter 9• OUTPUT NEW creates
- Page 210 and 211:
192Chapter 10Scoring is available o
- Page 212 and 213:
194Chapter 10*Get data to be scored
- Page 214 and 215:
196Chapter 10You have the option of
- Page 216 and 217:
198Chapter 10file in PMML format—
- Page 218 and 219:
200Chapter 10EEEESelect Response fo
- Page 220 and 221:
202Chapter 10EEESelect Response for
- Page 222 and 223:
204Chapter 10EEEEReplace 'file spec
- Page 224 and 225:
206Chapter 10value of 1 means that
- Page 226 and 227:
208Chapter 10Running Your Scoring J
- Page 228 and 229:
IntroductionChapter11The SPSS-Pytho
- Page 230 and 231:
212Chapter 11creating and debugging
- Page 232 and 233:
214Chapter 12Within a program block
- Page 234 and 235:
216Chapter 12The functions in the s
- Page 236 and 237:
218Chapter 12• spss.GetVariableMe
- Page 238 and 239:
220Chapter 12• In order to retrie
- Page 240 and 241:
222Chapter 12"Joe's Bar and Grille"
- Page 242 and 243:
224Chapter 12Passing Values from a
- Page 244 and 245:
226Chapter 12ExampleSuppose you nee
- Page 246 and 247:
228Chapter 12Figure 12-3Output from
- Page 248 and 249:
230Chapter 12Example: Simple Messag
- Page 250 and 251:
232Chapter 12Figure 12-5Simple file
- Page 252 and 253:
234Chapter 12Figure 12-6Simple mult
- Page 254 and 255:
236Chapter 12Getting HelpHelp with
- Page 256 and 257:
238Chapter 13• Notice that the tr
- Page 258 and 259:
240Chapter 13• First, loop throug
- Page 260 and 261:
242Chapter 13Displaying Command Syn
- Page 262 and 263:
244Chapter 13ExampleLet’s say you
- Page 264 and 265:
246Chapter 13• The function GetSP
- Page 266 and 267:
248Chapter 13Raising an Exception t
- Page 268 and 269:
250Chapter 13• The Submit functio
- Page 270 and 271:
252Chapter 13Another feature of run
- Page 272 and 273:
Chapter14Working with Variable Dict
- Page 274 and 275:
256Chapter 14Summarizing Variables
- Page 276 and 277:
258Chapter 14• varList is created
- Page 278 and 279:
260Chapter 14in the if statement wi
- Page 280 and 281:
262Chapter 14• For variables with
- Page 282 and 283:
264Chapter 14A Python list of varia
- Page 284 and 285:
266Chapter 14For the dataset and in
- Page 286 and 287:
268Chapter 14EvaluateXPath function
- Page 288 and 289:
270Chapter 14the parseString functi
- Page 290 and 291:
272Chapter 14ExampleThe sample data
- Page 292 and 293:
274Chapter 14• Notice that the st
- Page 294 and 295:
276Chapter 15Reading Case Data with
- Page 296 and 297:
278Chapter 15*python_get_cases_sequ
- Page 298 and 299:
280Chapter 15DATA LIST LIST (',') /
- Page 300 and 301:
282Chapter 15Creating New SPSS Vari
- Page 302 and 303:
284Chapter 15• To set case values
- Page 304 and 305:
286Chapter 15Example: Reducing a St
- Page 306 and 307:
288Chapter 15*python_reformat_strin
- Page 308 and 309:
290Chapter 15• Thecodemakesuseoft
- Page 310 and 311:
292Chapter 15the Spssdata class, yo
- Page 312 and 313:
294Chapter 15a for loop. The Spssda
- Page 314 and 315:
296Chapter 15*python_check_missing.
- Page 316 and 317:
298Chapter 15*python_Spssdata_split
- Page 318 and 319:
300Chapter 15• The Spssdata class
- Page 320 and 321:
302Chapter 15• Once specification
- Page 322 and 323:
304Chapter 15ThePythondatatypeNone
- Page 324 and 325:
306Chapter 15Appending New Cases wi
- Page 326 and 327:
308Chapter 15• Case values for ea
- Page 328 and 329:
310Chapter 15• spssdata.Spssdata(
- Page 330 and 331:
312Chapter 15rating formula makes u
- Page 332 and 333:
Retrieving Output from SPSSCommands
- Page 334 and 335:
316Chapter 16Note: Thespssaux modul
- Page 336 and 337:
318Chapter 16*python_write_workspac
- Page 338 and 339:
320Chapter 16As an aid to understan
- Page 340 and 341:
322Chapter 16two-tuple whose first
- Page 342 and 343:
324Chapter 16subtype identifier for
- Page 344 and 345:
326Chapter 16• Using /FORMAT=DFRE
- Page 346 and 347:
328Chapter 17full computational pow
- Page 348 and 349:
330Chapter 17text file containing P
- Page 350 and 351:
332Chapter 17As a further alternati
- Page 352 and 353:
334Chapter 17• The StartProcedure
- Page 354 and 355:
336Chapter 17Figure 17-4Pivot table
- Page 356 and 357:
338Chapter 17• The firstargumentt
- Page 358 and 359:
340Chapter 17Treating Categories or
- Page 360 and 361:
342Chapter 17• The row categories
- Page 362 and 363:
Data TransformationsChapter18The Py
- Page 364 and 365:
346Chapter 18The inputs must be com
- Page 366 and 367:
348Chapter 18*python_trans_ismissin
- Page 368 and 369:
350Chapter 18with the trans Module
- Page 370 and 371:
352Chapter 18Figure 18-3Resulting d
- Page 372 and 373:
354Chapter 18• The replacement st
- Page 374 and 375:
356Chapter 18be substituted for the
- Page 376 and 377:
358Chapter 18Example*python_extende
- Page 378 and 379:
360Chapter 18help(extendedTransform
- Page 380 and 381:
362Chapter 18• The Python variabl
- Page 382 and 383:
364Chapter 19If you use the PythonW
- Page 384 and 385:
366Chapter 19to call GetDesignatedO
- Page 386 and 387:
368Chapter 19string passed in as th
- Page 388 and 389:
370Chapter 19in the designated View
- Page 390 and 391:
372Chapter 20Youconvertablockofcomm
- Page 392 and 393:
374Chapter 20*python_converted_synt
- Page 394 and 395:
376Chapter 20SET MPRINT=OFF.DEFINE
- Page 396 and 397:
378Chapter 20• Notice that the co
- Page 398 and 399:
380Chapter 20To facilitate using OL
- Page 400 and 401:
382Chapter 20We’ll assume that yo
- Page 402 and 403:
384Chapter 20Setting the value of s
- Page 404 and 405:
Special TopicsChapter21Using Regula
- Page 406 and 407:
388Chapter 21• The OpenDataFile f
- Page 408 and 409:
390Chapter 21Locale IssuesFor users
- Page 410 and 411:
SPSS for SAS ProgrammersChapter22Re
- Page 412 and 413:
394Chapter 22proc sql;connect to od
- Page 414 and 415:
396Chapter 22assigns it a numeric d
- Page 416 and 417:
398Chapter 22Merging Files with the
- Page 418 and 419:
400Chapter 22• In the SPSS code,
- Page 420 and 421:
402Chapter 22Variable LabelsBoth SP
- Page 422 and 423:
404Chapter 22Cleaning and Validatin
- Page 424 and 425:
406Chapter 22• END IF in SPSS is
- Page 426 and 427:
408Chapter 22proc format;value opfm
- Page 428 and 429:
410Chapter 22• As in the recoding
- Page 430 and 431:
412Chapter 22• Both languages all
- Page 432 and 433:
414Chapter 22run;• SPSS uses subs
- Page 434 and 435:
416Chapter 22EXECUTE.data new;forma
- Page 436 and 437:
418Chapter 22Creating Custom Functi
- Page 438 and 439:
420Chapter 22BEGIN PROGRAM.import s
- Page 440 and 441:
422Chapter 22• The SetMacroValue
- Page 442 and 443:
Python Functions and ClassesAppendi
- Page 444 and 445:
426Appendix A• The argument templ
- Page 446 and 447:
428Appendix AResultFigure A-2Simple
- Page 448 and 449:
430Appendix AFigure A-3Resulting ta
- Page 450 and 451:
432Appendix A• The firstargumentt
- Page 452 and 453:
434Appendix A• Cell values must b
- Page 454 and 455:
436Appendix Acol_cat2 = CellText.St
- Page 456 and 457:
438Appendix AExamples of using the
- Page 458 and 459:
440Appendix Aposition within the di
- Page 460 and 461:
442Appendix ASetCell Method.SetCell
- Page 462 and 463:
444Appendix Atable.SetCategories(ro
- Page 464 and 465:
446Appendix Aof Count, which displa
- Page 466 and 467:
448Appendix Aas there are elements
- Page 468 and 469:
450Appendix AResultFigure A-13Table
- Page 470 and 471:
452Appendix AFormat nameCodePercent
- Page 472 and 473:
454Appendix AIn this example, row c
- Page 474 and 475:
456Appendix Aspss.BaseProcedure Cla
- Page 476 and 477:
458Appendix A• The procedure defi
- Page 478 and 479:
460Appendix AExamplehandle='demo'sp
- Page 480 and 481:
462Appendix A3,,4,dEND DATA.MISSING
- Page 482 and 483:
464Appendix A• The SetValueNumeri
- Page 484 and 485:
466Appendix A• Changes to the act
- Page 486 and 487:
468Appendix AMethod Read mode Write
- Page 488 and 489:
470Appendix A• When appending cas
- Page 490 and 491:
472Appendix A• Cases from the act
- Page 492 and 493:
474Appendix A• String values are
- Page 494 and 495:
476Appendix A• The value returned
- Page 496 and 497:
478Appendix A• This method is onl
- Page 498 and 499:
480Appendix ASetValueChar Method.Se
- Page 500 and 501:
482Appendix Acur.close()SetVarAttri
- Page 502 and 503:
484Appendix AFormat TypesTypeDescri
- Page 504 and 505:
486Appendix ASetVarNameAndType Meth
- Page 506 and 507:
488Appendix ASetVarNValueLabel Meth
- Page 508 and 509:
490Appendix ANote: In the SPSS docu
- Page 510 and 511:
492Appendix A• For other function
- Page 512 and 513:
494Appendix AExample#Create a list
- Page 514 and 515:
496Appendix A• MOYR. Month and ye
- Page 516 and 517:
498Appendix Aspss.GetVariableName F
- Page 518 and 519:
500Appendix AExampleimport spssweig
- Page 520 and 521:
502Appendix Aspss.SetDefaultPlugInV
- Page 522 and 523:
504Appendix AExampleIn this example
- Page 524 and 525:
506Appendix Ain the same table. Not
- Page 526 and 527:
508Appendix Adef groupMeans(groupVa
- Page 528 and 529:
510Appendix AResultFigure A-15Outpu
- Page 530 and 531:
512Appendix A• You can also use t
- Page 532 and 533:
514Appendix Aappend Method.append(l
- Page 534 and 535:
516Indexconcatenating string values
- Page 536 and 537:
518IndexIDEusing a Python IDE to dr
- Page 538 and 539:
520Indexraw strings, 220, 237, 241r
- Page 540:
522IndexUPCASE (function), 109UPDAT