spss.Procedure Class (Python)
spss.Procedure(procName,omsIdentifier). The Procedure
class implicitly
starts and ends a user procedure without the need to explicitly call StartProcedure
and EndProcedure
.
- The argument procName is a string and is the name that appears in the outline pane of
the Viewer associated with the output from the procedure. It has the
same specifications as the procedureName argument to the
StartProcedure
function. - The optional argument omsIdentifier specifies the OMS identifier for output from this procedure and
has the same specifications as the omsIdentifier argument to the
StartProcedure
function. omsIdentifier is only necessary when creating procedures with localized output so that the procedure name can be localized but not the OMS identifier. See the topic Localizing Output from Python Programs for more information.
The Procedure
class is designed
to be used with the Python with
statement as shown in the following example.
Example
BEGIN PROGRAM.
import spss
with spss.Procedure("demoProc"):
table = spss.BasePivotTable("Table Title",
"OMS table subtype")
table.SimplePivotTable(rowdim = "row dimension",
rowlabels = ["first row","second row"],
coldim = "column dimension",
collabels = ["first column","second column"],
cells = [11,12,21,22])
END PROGRAM.
-
with spss.Procedure("demoProc"):
initiates a block of code associated with a procedure named demoProc and implicitly starts the procedure. All code associated with the procedure should reside in the block as shown here. When the block completes, the procedure is implicitly ended.