[go: up one dir, main page]

0% found this document useful (0 votes)
132 views36 pages

Java Plug-In User Guide For IBM SPSS Statistics

bfd

Uploaded by

Reckon Indepth
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
0% found this document useful (0 votes)
132 views36 pages

Java Plug-In User Guide For IBM SPSS Statistics

bfd

Uploaded by

Reckon Indepth
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

Java Plug-in User Guide for IBM SPSS

Statistics


Note
Before using this information and the product it supports, read the information in “Notices” on page 25.

Product Information
This edition applies to version 22, release 0, modification 0 of IBM SPSS Statistics and to all subsequent releases and
modifications until otherwise indicated in new editions.
Contents
Chapter 1. Getting started with the Appending new cases . . . . . . . . . . 12
Integration Plug-in for Java . . . . . . 1
Invoking IBM SPSS Statistics from an external Java Chapter 5. Retrieving output from
application . . . . . . . . . . . . . . . 1 syntax commands . . . . . . . . . . 15
Creating IBM SPSS Statistics extension commands in Retrieving output from syntax commands . . . . 15
Java . . . . . . . . . . . . . . . . . 2
Chapter 6. Creating custom output . . 19
Chapter 2. Running IBM SPSS Statistics Creating custom output . . . . . . . . . . 19
commands . . . . . . . . . . . . . 5 Creating pivot tables . . . . . . . . . . 19
Running IBM SPSS Statistics commands . . . . . 5 Creating text blocks . . . . . . . . . . 21
Creating output for extension commands . . . 21
Chapter 3. Retrieving dictionary
information . . . . . . . . . . . . . 7 Chapter 7. Deploying an external Java
Retrieving dictionary information . . . . . . . 7 application . . . . . . . . . . . . . 23

Chapter 4. Working with case data in the Notices . . . . . . . . . . . . . . 25


active dataset . . . . . . . . . . . . 9 Trademarks . . . . . . . . . . . . . . 27
Working with case data in the active dataset. . . . 9
Reading case data . . . . . . . . . . . 9 Index . . . . . . . . . . . . . . . 29
Creating new variables in the active dataset . . 11

iii
iv Java Plug-in User Guide for IBM SPSS Statistics
Chapter 1. Getting started with the Integration Plug-in for Java
The IBM® SPSS® Statistics - Integration Plug-in for Java enables an application developer to create Java
applications that can invoke and control the IBM SPSS Statistics processor, or to implement extension
commands in Java that can then be run from within IBM SPSS Statistics. Extension commands are IBM
SPSS Statistics commands that are implemented in an external language (Python, R or Java) and allow
users who are proficient in that language to share external functions with users of standard IBM SPSS
Statistics command syntax.

With the IBM SPSS Statistics - Integration Plug-in for Java, you can do the following:
v Execute IBM SPSS Statistics command syntax.
v Read case data from the active dataset.
v Get information about data in the active dataset.
v Add new variables and append cases to the active dataset.
v Get output results from syntax commands.
v Create custom output in the form of pivot tables and text blocks.

The IBM SPSS Statistics - Integration Plug-in for Java is installed with IBM SPSS Statistics and IBM SPSS
Statistics Server and requires no separate installation or configuration. For version 22 of IBM SPSS
Statistics, the IBM SPSS Statistics - Integration Plug-in for Java supports Java version 6.

The IBM SPSS Statistics - Integration Plug-in for Java is designed to work with Unicode mode. Use of the
IBM SPSS Statistics - Integration Plug-in for Java with code page mode is not recommended.

Complete documentation for all of the classes and methods available with the IBM SPSS Statistics -
Integration Plug-in for Java is available in the Help system under the heading IBM SPSS Statistics -
Integration Plug-in for Java API Reference.

Invoking IBM SPSS Statistics from an external Java application


The interface for invoking IBM SPSS Statistics and controlling the IBM SPSS Statistics processor is
provided in the JAR file [Link], which is installed with your IBM SPSS Statistics product. The
JAR file contains the [Link] package, which contains the Java classes available with the
IBM SPSS Statistics - Integration Plug-in for Java. Following are the locations of [Link] by
operating system. Be sure to add [Link] to your Java class path.
v On Windows, [Link] is located in the IBM SPSS Statistics installation directory.
v On Linux and UNIX Server systems, [Link] is located in the bin directory under the IBM
SPSS Statistics installation directory.
v On Mac OS, [Link] is located in the bin directory under the Content directory in the IBM
SPSS Statistics application bundle.

Important: Do not move [Link] from its installed location. The IBM SPSS Statistics - Integration
Plug-in for Java assumes that [Link] is in the installed location.

Note: For information on deploying your application on end user machines, please see Chapter 7,
“Deploying an external Java application,” on page 23.

When invoked from an external Java application, the IBM SPSS Statistics processor runs without an
associated instance of the IBM SPSS Statistics client. In this mode, output generated from IBM SPSS

© Copyright IBM Corporation 1989, 2013 1


Statistics can be managed with parameters specified on the method that starts the processor or through
use of the IBM SPSS Statistics Output Management System, which is invoked with the OMS command.

The following is a simple example of using the IBM SPSS Statistics - Integration Plug-in for Java to create
a dataset in IBM SPSS Statistics, compute descriptive statistics and generate output. It illustrates the basic
features of invoking IBM SPSS Statistics from an external Java application.
import [Link].*;

public class demo {public static void main(String[] args) {

try {
[Link]();
String[] command={"OMS",
"/DESTINATION FORMAT=HTML OUTFILE=’/output/[Link]’.",
"DATA LIST FREE /salary (F).",
"BEGIN DATA",
"21450",
"30000",
"57000",
"END DATA.",
"DESCRIPTIVES salary.",
"OMSEND."};
[Link](command);
[Link]();
} catch (StatsException e) {
[Link]();
}
}

}
v The statement import [Link].* imports all of the classes in the
[Link] package.
v The [Link] method starts the IBM SPSS Statistics processor.
v A string array specifies IBM SPSS Statistics command syntax that creates a dataset and runs the
DESCRIPTIVES procedure. The command syntax is submitted to IBM SPSS Statistics using the
[Link] method. Output from the DESCRIPTIVES procedure is routed to an HTML file using
the OMS command.
v The [Link] method stops the IBM SPSS Statistics processor and should be called to properly
end an IBM SPSS Statistics session.
v The StatsException class is a subclass of the native Java Exception class, and handles exceptions that
are specific to the IBM SPSS Statistics - Integration Plug-in for Java. It can be inherited to define
custom exception classes for your application.

Creating IBM SPSS Statistics extension commands in Java


This topic describes aspects of extension commands that are specific to implementing extension
commands in Java. Detailed information on creating extension commands is provided in the article
"Writing IBM SPSS Statistics Extension Commands", available from the SPSS Community at
[Link]

Implementation code

The implementation code can consist of a JAR file or Java class files.
v When using a JAR file, the name of the JAR file must be the same as the name of the extension
command, and in upper case. For multi-word command names, spaces between words should be
replaced with underscores when constructing the name of the JAR file. The JAR file must contain a
class file with the same name as the JAR file and the class must not be part of a package.
v When using standalone Java class files, there must be one class file with the same name as that of the
extension command, and in upper case. For multi-word command names, spaces between words
should be replaced with underscores when constructing the name of the Java class file.

2 Java Plug-in User Guide for IBM SPSS Statistics


Whether using a JAR file or standalone Java class files, the class file with the same name as the extension
command should contain the following:
v A constructor method, which does not have a parameter, for the class.
v A public static method named Run with a single Hashtable argument that should be specified as
follows:
Hashtable<String, Hashtable<String, Object>>
v A public method that implements the command.

XML command syntax specification


v For extension commands implemented in Java, the Language attribute of the Command element should be
set to "Java".
v For Java extension commands implemented with a JAR file, the Mode attribute of the Command element
should be set to "Package".

Sample Java class

The following is an example of a Java class for an extension command named DEMO, which simply takes a
variable list as input and prints out the list. It demonstrates the basic structure of the implementation
code and the means by which values are passed from the command syntax (submitted by the user) to the
method that implements the command.
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link].*;

public class DEMO {

public DEMO() {
[Link]("This is the constructor method");
}

public static void Run(Hashtable<String, Hashtable<String, Object>> args)


{
try {
List<TemplateClass> testList = [Link](
[Link]("VARIABLES", "","vars", "existingvarlist", true));

SyntaxClass oobj = [Link](testList);


[Link](oobj, args, "printvars");

} catch (Exception e) {
[Link]();
}
}

public void printvars(@ParamName("vars") ArrayList<String> variables)


{
[Link]("variables = " + variables);
}
}

Briefly, the functions of the Run, Template, Syntax and processcmd methods are as follows:
v IBM SPSS Statistics parses the command syntax entered by the user and passes the specified values to
the Run function in a single argument--args in this example.
v The Run function contains calls to the [Link], [Link], and
[Link] methods, which are designed to work together.
[Link] specifies the details needed to process a specified keyword in the syntax for an
extension command. In this example, the extension command contains the single keyword VARIABLES.
[Link] validates the values passed to the Run function according to the templates specified
for the keywords.

Chapter 1. Getting started with the Integration Plug-in for Java 3


[Link] parses the values passed to the Run function and calls the function that will
actually implement the command--in this example, the printvars method.

Values of specific keywords from the submitted syntax are mapped to variables in the method that
implements the command (printvars in this example) using a Java annotation. In this example, the
[Link] method specifies that the value of the VARIABLES keyword is associated with the
identifier "vars". The argument to the printvars method specifies that this identifier is mapped to the
local variable variables. This is accomplished with the @ParamName("vars") annotation. You include such
an annotation for each keyword in the syntax for the extension command.

The annotation mechanism also requires that arguments to the implementation method are defined as
object types, not primitive data types. In particular, you must use the object types Integer, Short, Long,
Float, Double, Byte, Character and Boolean instead of the primitive data types int, short, long, float,
double, byte, char and boolean. Note that in the above example, the value passed to the printvars
method is an array of strings and is defined as an ArrayList object.

Deploying an extension command

To deploy an extension command, it is best to create an extension bundle for the command and add both
the implementation code (JAR file or Java class files) and the XML file specifying the command syntax to
the bundle. You can distribute the extension bundle (spe) file to other users who can then install it and
begin using your extension command. Information on extension bundles is available from Core
System>Utilities>Working with extension bundles, in the Help system.

4 Java Plug-in User Guide for IBM SPSS Statistics


Chapter 2. Running IBM SPSS Statistics commands
Running IBM SPSS Statistics commands
The submit method from the StatsUtil class is used to submit syntax commands to IBM SPSS Statistics
for processing. It takes a string that resolves to a complete syntax command, or an array of strings that
resolves to one or more complete syntax commands. Output from syntax commands can be written to the
standard output stream or to an external file. It can also be directed to an in-memory workspace where it
is stored as XML and can then be retrieved using XPath expressions. See the topic “Retrieving output
from syntax commands” on page 15 for more information.

Submitting a single command

You submit a single command to IBM SPSS Statistics by providing a string representation of the
command as shown in this example. When submitting a single command in this manner the period (.) at
the end of the command is optional.
[Link]("GET FILE=’/data/Employee [Link]’.");
[Link]("DESCRIPTIVES SALARY.");
v The submit method is called twice; first to submit a GET command and then to submit a DESCRIPTIVES
command.

Submitting commands using an array

You can submit multiple commands as an array of strings where each array element is a string
representation of a syntax command. The string for each command must be terminated with a period (.)
as shown in this example.
[Link]("GET FILE=’/data/Employee [Link]’.");
String[] cmdLines = {"DESCRIPTIVES SALARY SALBEGIN.","FREQUENCIES EDUC JOBCAT."};
[Link](cmdLines);
v The submit method is called with an array that specifies a DESCRIPTIVES and a FREQUENCIES command.

You can also use the elements of an array to represent parts of a command so that a single array specifies
one or more complete syntax commands. When submitting multiple commands in this manner, each
command must be terminated with a period (.) as shown in this example.
[Link]("GET FILE=’/data/Employee [Link]’.");
String[] cmdLines = {"OMS /SELECT TABLES ",
"/IF COMMANDS = [’Descriptives’ ’Frequencies’] ",
"/DESTINATION FORMAT = HTML ",
"IMAGES = NO OUTFILE = ’/output/[Link]’.",
"DESCRIPTIVES SALARY SALBEGIN.",
"FREQUENCIES EDUC JOBCAT.",
"OMSEND."};
[Link](cmdLines);
v The submit method is called with an array that specifies an OMS command followed by a DESCRIPTIVES
command, a FREQUENCIES command, and an OMSEND command. The first four elements of the array are
used to specify the OMS command.

Displaying command syntax generated by the submit method

For debugging purposes, it is convenient to see the completed syntax passed to IBM SPSS Statistics by
any calls to the submit method. This is enabled through command syntax with SET PRINTBACK ON MPRINT
ON.

© Copyright IBM Corporation 1989, 2013 5


String[] cmdLines = {"SET PRINTBACK ON MPRINT ON.",
"GET FILE=’/data/Employee [Link]’."};
[Link](cmdLines);
String varName;
varName = [Link](1);
[Link]("FREQUENCIES /VARIABLES=" + varName + ".");

The generated command syntax shows the completed FREQUENCIES command as well as the GET
command. In the present example the variable with index value 1 in the dataset has the name gender.
M> GET FILE=’c:/data/Employee [Link]’.
M> FREQUENCIES /VARIABLES=gender.

6 Java Plug-in User Guide for IBM SPSS Statistics


Chapter 3. Retrieving dictionary information
Retrieving dictionary information
The Cursor, DataUtil and StatsUtil classes provide a number of methods for retrieving dictionary
information from the active dataset. The following information is available:
v [Link]. The attribute values for a specified datafile attribute.
v [Link]. Names of any datafile attributes for the active dataset.
v [Link]. The details of a specified multiple response set.
v [Link]. The names of any multiple response sets for the active dataset.
v [Link]. The user-missing values, if any, for a specified numeric variable.
v [Link]. The value labels, if any, for a specified numeric variable.
v [Link]. The user-missing values, if any, for a specified string variable.
v [Link]. The value labels, if any, for a specified string variable.
v [Link]. Names of any custom variable attributes for a specified variable.
v [Link]. The attribute values for a specified attribute of a specified variable.
v [Link]. The number of variables in the active dataset.
v [Link]. The display format for a specified variable; for example, F8.2.
v [Link]. The variable label, if any, for a specified variable.
v [Link]. The measurement level for a specified variable.
v [Link]. The variable name for a variable specified by its index position. Index
positions start with 0 for the first variable in file order.
v [Link]. The variable role (for example, INPUT or TARGET) for a specified variable.
v [Link]. The variable type (numeric or string) for a specified variable.
v [Link]. The index position, in the active dataset, of a specified variable.
v [Link]. The names of the variables in the active dataset.
v [Link]. The names of the split variables, if any.
v [Link]. The name of the weight variable, if any.

Example

Consider the common scenario of running a particular block of command syntax only if a specific
variable exists in the dataset. For example, you are processing many datasets containing employee
records and want to split them by gender--if a gender variable exists--to obtain separate statistics for the
two gender groups. We will assume that if a gender variable exists, it has the name gender, although it
may be spelled in upper case or mixed case. The following sample code illustrates the approach:
[Link]("GET FILE=’/data/Employee [Link]’.");
DataUtil datautil = new DataUtil();
String[] varnames = [Link]();
[Link]();
for(String name: varnames){
if([Link]().equals("gender")){
String[] command={"SORT CASES BY " + name + ".",
"SPLIT FILE LAYERED BY " + name + "."};
[Link](command);
}
}

7
8 Java Plug-in User Guide for IBM SPSS Statistics
Chapter 4. Working with case data in the active dataset
Working with case data in the active dataset
The IBM SPSS Statistics - Integration Plug-in for Java provides the ability to read case data from the
active dataset, create new variables in the active dataset, and append new cases to the active dataset. The
functionality for reading from and writing to the active dataset is provided in the Cursor class. An
instance of the Cursor class creates an open cursor, which provides access to the active dataset. The
following rules apply to the use of cursors:
v You cannot use the submit method from the StatsUtil class while a data cursor is open. You must
close the cursor first using the close method. In particular, if you need to save changes made to the
active dataset to an external file, then use the submit method to submit a SAVE command after closing
the cursor.
v Only one data cursor can be open at any point in an application. To define a new data cursor, you
must first close the previous one.

While the Cursor class provides the full set of methods for accessing the active dataset, the simpler
DataUtil class is a wrapper for the Cursor class and provides the ability to read cases, create new
variables and append new cases. The examples in this section use the DataUtil class. Because the
DataUtil class is a wrapper for the Cursor class, the above limitations on cursors also apply to DataUtil
objects. The following apply:
v You cannot use the submit method from the StatsUtil class while a DataUtil object exists. You must
release the resources associated with the object with the release method. As with cursors, if you need
to save changes made to the active dataset to an external file, then use the submit method to submit a
SAVE command after releasing the DataUtil object.
v Only one DataUtil object can exist at a time. To create a new DataUtil object, you must first release the
previous one.

Note: To create a new dataset, use the submit method in the StatsUtil class to submit a DATA LIST
command.

Reading case data


You retrieve cases using the fetchCases method from the DataUtil class. You can retrieve cases one at a
time in sequential order or you can retrieve multiple cases (including all cases) with a single call to the
fetchCases method.
v System-missing values are always returned as the Java null value, however you can specify whether
user-missing values are treated as valid or also returned as null. See the example on missing data.
v By default, data retrieved from a variable representing a date, or a date and a time, is given as the
number of seconds from October 14, 1582. You can specify that values read from IBM SPSS Statistics
variables with date or datetime formats be converted to Java Calendar objects with the
setConvertDateTypes method as shown in the following example.
v When retrieving cases, any case filtering specified with the FILTER or USE commands is honored.

Example
[Link]("GET FILE=’/data/[Link]’.");
DataUtil datautil = new DataUtil();
[Link](true);
Case[] data = [Link](false, 0);
Double numvar;
String strvar;
Calendar datevar;
for(Case onecase: data){
for(int i = 0;i<[Link]();i++){
CellValueFormat format = [Link](i);

9
if(format == [Link]){
numvar = [Link](i);
}
else if(format == [Link]){
strvar = [Link](i);
}
else if(format == [Link]){
datevar = [Link](i);
}
}
}
[Link]();
v You first create an instance of the DataUtil class. In this example, the variable datautil is a DataUtil
object.
v The setConvertDateTypes method specifies that values read from IBM SPSS Statistics variables with
date or datetime formats will be converted to Java Calendar objects.
v The fetchCases method retrieves all cases from the active dataset. The first argument specifies that
user-missing values will be treated as missing and thus converted to the Java null value. The second
argument specifies that all cases, starting with case 0, will be retrieved from the active dataset. You can
retrieve cases starting from an arbitrary case number by specifying a different value for the second
argument. You can also retrieve a specified number of cases, using an overloaded form of fetchCases
with a third argument specifying the number of cases to retrieve.
v The fetchCases method returns a Case object, which represents an array of cases. The items in a given
element of the array correspond to the values of the variables in a particular case of data from the
active dataset, in file order. You can get the number of items in each case from the getCellNumber
method of the Case object.
v The type of value in each item of a case is available from the getCellValueFormat method of the Case
object. Values are retrieved from the Case object with methods specific to each type of value, as shown
here for numeric, string and date values.

Retrieving data for a subset of variables

You can specify a subset of variables for which data will be retrieved. You can specify the set of variables
by name or by their index position in the active dataset. Index positions start with 0 for the first variable
in file order.
[Link]("GET FILE=’/data/employee [Link]’.");
DataUtil datautil = new DataUtil();
String[] varNames = new String[]{"id","educ","salary"};
[Link](varNames);
Case[] data = [Link](false, 0);

The setVariableFilter method specifies the subset of variables for which data will be retrieved. In this
example, only data for the variables id, educ and salary will be retrieved.

Missing data

The first argument to the fetchCases method specifies whether user-missing values are converted to the
Java null value or treated as valid data. System-missing values are always converted to the Java null
value.
String[] command={"DATA LIST LIST (’,’) /numVar (f) stringVar (a4).",
"BEGIN DATA",
"1,a",
",b",
"3,,",
"9,d",
"END DATA.", _
"MISSING VALUES numVar (9) stringVar (’ ’)."}
[Link](command);
DataUtil datautil = new DataUtil();
Case[] data = [Link](false, 0);
[Link]();

Setting the first argument to fetchCases to false specifies that user-missing values are converted to the
Java null value. The values read from IBM SPSS Statistics and stored in the variable data are:
10 Java Plug-in User Guide for IBM SPSS Statistics
1 a
null b
3 null
null d

You can specify that user-missing values be treated as valid data by setting the first argument to the
fetchCases method to true. The values of data are now:
1 a
null b
3
9 d

Handling Data with Splits

The getSplitIndex method, from the DataUtil class, allows you to detect split changes when reading
from datasets that have splits.
String[] command={"DATA LIST FREE /salary (F) jobcat (F).",
"BEGIN DATA",
"21450 1",
"45000 1",
"30000 2",
"30750 2",
"103750 3",
"72500 3",
"57000 3",
"END DATA.",
"SPLIT FILE BY jobcat."};
[Link](command);
DataUtil datautil = new DataUtil();
int splitindex;
splitindex = [Link](0);
while(splitindex!=-1){
[Link]("A new split begins at case: " + splitindex);
splitindex = [Link](splitindex);
}
[Link]();
v [Link] gets the case number of the first case in the split following the specified case.
For the sample dataset used in this example, split boundaries are crossed when reading the 3rd and
5th cases. Case numbers start from 0.
v If there are no split boundaries following the specified case, then [Link] returns -1.

Creating new variables in the active dataset


The DataUtil class enables you to add new variables, along with their case values, to the active dataset.

Example

In this example we create a new string variable, a new numeric variable and a new date variable, and
populate case values for them. A sample dataset is first created.
String[] command={"DATA LIST FREE /case (A5).",
"BEGIN DATA",
"case1",
"case2",
"case3",
"END DATA."};
[Link](command);
Variable numVar = new Variable("numvar",0);
Variable strVar = new Variable("strvar",1);
Variable dateVar = new Variable("datevar",0);
[Link]([Link]);
double[] numValues = new double[]{1.0,2.0,3.0};
String[] strValues = new String[]{"a","b","c"};
Calendar dateValue = [Link]();
[Link]([Link], 2012);
[Link]([Link], [Link]);
[Link](Calendar.DAY_OF_MONTH, 1);
Calendar[] dateValues = new Calendar[]{dateValue};
DataUtil datautil = new DataUtil();
[Link](numVar, numValues, 0);
[Link](strVar, strValues, 0);
[Link](dateVar, dateValues, 0);
[Link]();

Chapter 4. Working with case data in the active dataset 11


v The Variable class creates the specification for a new variable to be added to the active dataset. The
first argument to the constructor is the name of the variable and the second argument is an integer
specifying the variable type. Numeric variables have a variable type of 0 and string variables have a
variable type equal to the defined length of the string (maximum of 32767 bytes).
v The addVariableWithValue method of the DataUtil class adds a new variable to the active dataset. The
first argument to the method is the Variable object that specifies the properties of the variable. The
second argument is an array that specifies the value of the variable for each case in the active dataset
to be populated. The third argument specifies the index of the case at which to begin populating the
variable values. Case indexes start with 0 for the first case in the active dataset.
For numeric variables, cases that are not populated are set to the system-missing value. For string
variables, cases that are not populated are set to a blank value. In this example, only the first case is
populated for the variable dateVar.
v Variables representing a date, or a date and a time, in IBM SPSS Statistics are numeric variables that
have a date or datetime format. In the above example, the variable dateVar is a numeric variable whose
format has been set to DATE with the setFormatType method of the associated Variable object. When
setting the value for such a variable, use a Java Calendar object as shown in this example.

Note: To save the modified active dataset to an external file, use the submit method (following the
release method) to submit a SAVE command, as in:
[Link]("SAVE OUTFILE=’/data/[Link]’.")

Example: Multiple data passes

Sometimes more than one pass of the data is required, as in the following example involving two data
passes. The first data pass is used to read the data and compute a summary statistic. The second data
pass is used to add a summary variable to the active dataset.
String[] command={"DATA LIST FREE /var (F).",
"BEGIN DATA",
"40200",
"21450",
"21900",
"END DATA."};
[Link](command);
Double total = 0.0;
DataUtil datautil = new DataUtil();
Case[] data = [Link](false, 0);
for(Case onecase: data){
total = total + [Link](0);
}
Double meanval = total/[Link];
Variable mean = new Variable("mean",0);
double[] meanVals = new double[[Link]];
for (int i=0;i<[Link];i++){
meanVals[i]=meanval;
}
[Link](mean, meanVals, 0);
[Link]();

Appending new cases


The DataUtil class enables you to append new cases to the active dataset.

Example

In this example a single case is appended to the active dataset.


String[] command={"DATA LIST FREE /case (F) value (A1) date(ADATE).",
"BEGIN DATA",
"1 a 01/01/2012",
"END DATA."};
[Link](command);
Case newcase = new Case(3);
DataUtil datautil = new DataUtil();
Calendar date = [Link]();
[Link]([Link], 2013);
[Link]([Link], [Link]);
[Link](Calendar.DAY_OF_MONTH, 1);

12 Java Plug-in User Guide for IBM SPSS Statistics


[Link](0, 2);
[Link](1, "b");
[Link](2, date);
[Link](newcase);
[Link]();
v To append a case to the active dataset, you create a Case object that represents a single case, and
populate it with the values of the variables for the case. The variable values are populated with the
setCellValue method of the Case object. The first argument to this method is the index of the
associated variable in the active dataset, starting with 0 for the first variable in file order. In this
example, the variable case has index 0, the variable value has index 1 and the variable date has index 2.
The second argument to the setCellValue method is the value of the variable for the given case.
v To specify the value of variable with a date or datetime format, use a Java Calendar object as shown in
this example.
v The appendCase method of the DataUtil object appends the case. Its only argument is the Case object
that specifies the case.
v A numeric variable whose value is not specified in the Case object is set to the system-missing value. A
string variable whose value is not specified in the Case object will have a blank value. The value will
be valid unless you explicitly define the blank value to be missing for that variable. You can also use
an overloaded form of the setCellValue method to set the value of a specified cell in the Case object to
the Java null value, in which case it will be treated the same as if the value of the cell was not
specified.

Chapter 4. Working with case data in the active dataset 13


14 Java Plug-in User Guide for IBM SPSS Statistics
Chapter 5. Retrieving output from syntax commands
Retrieving output from syntax commands
You can retrieve output generated by IBM SPSS Statistics commands without writing the output to an
external file. This is accomplished by routing the output via the Output Management System (OMS) to an
area in memory referred to as the XML workspace where it is stored as an XPath DOM that conforms to
the IBM SPSS Statistics Output XML Schema. Output is retrieved from this workspace with functions that
employ XPath expressions.

Constructing the correct XPath expression (IBM SPSS Statistics currently supports XPath 1.0) requires an
understanding of the Output XML schema. The output schema [Link] is distributed with
IBM SPSS Statistics. Documentation is included in the IBM SPSS Statistics Help system.

Example

In this example, we'll retrieve the mean value of a variable calculated from the Descriptives procedure.
String[] command={"GET FILE=’/data/Employee [Link]’.",
"OMS SELECT TABLES ",
"/IF COMMANDS=[’Descriptives’] SUBTYPES=[’Descriptive Statistics’] ",
"/DESTINATION FORMAT=OXML XMLWORKSPACE=’desc_table’ ",
"/TAG=’desc_out’.",
"DESCRIPTIVES VARIABLES=salary, salbegin, jobtime, prevexp ",
"/STATISTICS=MEAN.",
"OMSEND TAG=’desc_out’."};
[Link](command);
String handle = "desc_table";
String context = "/outputTree";
String xpath = "//pivotTable[@subType=’Descriptive Statistics’]" +
"/dimension[@axis=’row’]" +
"/category[@varName=’salary’]" +
"/dimension[@axis=’column’]" +
"/category[@text=’Mean’]" +
"/cell/@text";
String result = [Link](handle, context, xpath);
[Link](handle);
v The OMS command is used to direct output from a syntax command to the XML workspace. The
XMLWORKSPACE keyword on the DESTINATION subcommand, along with FORMAT=OXML, specifies the XML
workspace as the output destination. It is a good practice to use the TAG subcommand, as done here, so
as not to interfere with any other OMS requests that may be operating. The identifiers used for the
COMMANDS and SUBTYPES keywords on the IF subcommand can be found in the OMS Identifiers dialog
box, available from the Utilities menu in IBM SPSS Statistics.
v The XMLWORKSPACE keyword is used to associate a name with this XPath DOM in the workspace. In the
current example, output from the DESCRIPTIVES command will be identified with the name desc_table.
You can have many XPath DOM's in the XML workspace, each with its own unique name.
v The OMSEND command terminates active OMS commands, causing the output to be written to the
specified destination--in this case, the XML workspace.
v You retrieve values from the XML workspace with the evaluateXPath method from the StatsUtil class.
The method takes an explicit XPath expression, evaluates it against a specified XPath DOM in the XML
workspace, and returns the result as an array of string values.
v The first argument to the evaluateXPath function specifies the XPath DOM to which an XPath
expression will be applied. This argument is referred to as the handle name for the XPath DOM and is
simply the name given on the XMLWORKSPACE keyword on the associated OMS command. In this case the
handle name is desc_table.
v The second argument to evaluateXPath defines the XPath context for the expression and should be set
to "/outputTree" for items routed to the XML workspace by the OMS command.

15
v The third argument to evaluateXPath specifies the remainder of the XPath expression (the context is
the first part). Since XPath expressions almost always contain quoted strings, you'll need to use a
different quote type from that used to enclose the expression. For users familiar with XSLT for OXML
and accustomed to including a namespace prefix, note that XPath expressions for the evaluateXPath
function should not contain the oms: namespace prefix.
v The XPath expression in this example is specified by the variable xpath. It is not the minimal expression
needed to select the mean value of interest but is used for illustration purposes and serves to highlight
the structure of the XML output.
//pivotTable[@subType=’Descriptive Statistics’] selects the Descriptives Statistics table.
/dimension[@axis=’row’]/category[@varName=’salary’] selects the row for the variable salary.
/dimension[@axis=’column’]/category[@text=’Mean’] selects the Mean column within this row, thus
specifying a single cell in the pivot table.
/cell/@text selects the textual representation of the cell contents.
v When you have finished with a particular output item, it is a good idea to delete it from the XML
workspace. This is done with the deleteXPathHandle method, whose single argument is the name of
the handle associated with the item.

If you're familiar with XPath, note that the mean value of salary can also be selected with the following
simpler XPath expression:
//category[@varName=’salary’]//category[@text=’Mean’]/cell/@text

Note: To the extent possible, construct your XPath expressions using language-independent attributes,
such as the variable name rather than the variable label. That will help reduce the translation effort if you
need to deploy your code in multiple languages. Also consider factoring out language-dependent
identifiers, such as the name of a statistic, into constants. You can obtain the current language used for
pivot table output with the syntax command SHOW OLANG.

You may also consider using text_eng attributes in place of text attributes in XPath expressions.
text_eng attributes are English versions of text attributes and have the same value regardless of the
output language. The OATTRS subcommand of the SET command specifies whether text_eng attributes are
included in OXML output.

Writing XML workspace contents to a file

When writing and debugging XPath expressions, it is often useful to have a sample file that shows the
XML structure. This can be obtained with the getXMLUTF16 method from the StatsUtil class, as well as by
an option on the OMS syntax command. The following code recreates the XML workspace for the
preceding example and writes the XML associated with the handle desc_table to an external file.
String[] command={"GET FILE=’/data/Employee [Link]’.",
"OMS SELECT TABLES ",
"/IF COMMANDS=[’Descriptives’] SUBTYPES=[’Descriptive Statistics’] ",
"/DESTINATION FORMAT=OXML XMLWORKSPACE=’desc_table’ ",
"/TAG=’desc_out’.",
"DESCRIPTIVES VARIABLES=salary, salbegin, jobtime, prevexp ",
"/STATISTICS=MEAN.",
"OMSEND TAG=’desc_out’."};
[Link](command);
String result = StatsUtil.getXMLUTF16("desc_table");
Writer out = new OutputStreamWriter(new FileOutputStream("/output/descriptives_table.xml"));
[Link](result);
[Link]();
[Link]("desc_table");

The section of the output file that specifies the Descriptive Statistics table, including the mean value of
salary, is as follows (the output is written in Unicode (UTF-16)):
<pivotTable subType="Descriptive Statistics" text="Descriptive Statistics">
<dimension axis="row" text="Variables">
<category label="Current Salary" text="Current Salary"
varName="salary" variable="true">
<dimension axis="column" text="Statistics">

16 Java Plug-in User Guide for IBM SPSS Statistics


<category text="N">
<cell number="474" text="474"/>
</category>
<category text="Mean">
<cell decimals="2" format="dollar" number="34419.567510548"
text="$34,419.57"/>
</category>
</dimension>
</category>

Retrieving images associated with an output XPath DOM

You can retrieve images associated with output routed to the XML workspace. In this example, we'll
retrieve a bar chart associated with output from the Frequencies procedure.
String[] command={"GET FILE=’/data/Employee [Link]’.",
"OMS SELECT CHARTS ",
"/IF COMMANDS=[’Frequencies’] ",
"/DESTINATION FORMAT=OXML IMAGES=YES",
"CHARTFORMAT=IMAGE IMAGEROOT=’myimages’ IMAGEFORMAT=JPG XMLWORKSPACE=’demo’.",
"FREQUENCIES VARIABLES=jobcat",
" /BARCHART PERCENT",
" /ORDER=ANALYSIS.",
"OMSEND."};
[Link](command);
String handle = "demo";
String context = "/outputTree";
String xpath = "//command[@command=’Frequencies’]" +
"/chartTitle[@text=’Bar Chart’]" +
"/chart/@imageFile";
String[] result = [Link](handle, context, xpath);
String imageName = result[0];
BufferedImage imageObj = [Link](handle, imageName);
File outputFile = new File("/output/[Link]");
[Link](imageObj, "JPG", outputFile);
[Link](handle);
v The OMS command routes output from the FREQUENCIES command to an output XPath DOM with the
handle name of demo.
v To route images along with the OXML output, the IMAGES keyword on the DESTINATION subcommand
(of the OMS command) must be set to YES, and the CHARTFORMAT, MODELFORMAT, or TREEFORMAT keyword
must be set to IMAGE.
v The evaluateXPath function is used to retrieve the name of the image associated with the bar chart
output from the FREQUENCIES command. In the present example, the value returned by evaluateXPath
is a list with a single element, which is then stored to the variable imageName.
v The getImage method of the StatsUtil class retrieves the image, which is then written to an external
file.
The first argument to the getImage function specifies the particular XPath DOM and must be a valid
handle name defined by a previous IBM SPSS Statistics OMS command.
The second argument to getImage is the filename associated with the image in the OXML
output--specifically, the value of the imageFile attribute of the chart element associated with the
image.

Chapter 5. Retrieving output from syntax commands 17


18 Java Plug-in User Guide for IBM SPSS Statistics
Chapter 6. Creating custom output
Creating custom output
The IBM SPSS Statistics - Integration Plug-in for Java provides the ability to create output in the form of
custom pivot tables and text blocks. Using the Output Management System (OMS), the output can be
rendered in a variety of formats such as HTML, text, or XML that conforms to the IBM SPSS Statistics
Output XML Schema. If you are generating output as part of an extension command implemented in
Java, then the output will be displayed in the Viewer by default.

Creating pivot tables


The following figure shows the basic structural components of a pivot table. For IBM SPSS Statistics
version 22, the IBM SPSS Statistics - Integration Plug-in for Java supports pivot tables with one row
dimension and one column dimension. Each dimension contains a set of categories that label the
elements of the dimension--for instance, row labels for a row dimension.

Each cell in the table can be specified by a combination of category values. In the example shown here,
the indicated cell is specified by a category value of Male for the Gender dimension and Custodial for the
Employment Category dimension.

Figure 1. Pivot table structure

Pivot tables are created with the PivotTable class, as shown in the following example. This example
assumes that you are creating pivot table output for an external Java application that will invoke IBM
SPSS Statistics, so that the output is routed with OMS.
String[] command={
"OMS SELECT TABLES",
"/IF SUBTYPES=[’pivotTableDemo’]",
"/DESTINATION FORMAT=HTML OUTFILE=’/output/[Link]’."
};
[Link](command);
Object[] rowLabels = new Object[] {"row1", "row2"};
Object[] colLabels = new Object[] { "columnA", "columnB"};
Object[][] cells = new Object[][] {{"1A","1B"}, {"2A","2B"}};
String title = "Sample pivot table";
String templateName = "pivotTableDemo";
String outline = "";
String caption = "";
String rowDim = "Row dimension";
String columnDim = "Column dimension";
boolean hideRowDimTitle = false;
boolean hideRowDimLabel = false;
boolean hideColDimTitle = false;
boolean hideColDimLabel = false;
PivotTable table = new PivotTable(cells, rowLabels, colLabels,
title, templateName, outline, caption, rowDim,

19
columnDim, hideRowDimTitle, hideRowDimLabel,
hideColDimTitle, hideColDimLabel, [Link]);
[Link]();
[Link]("OMSEND.");

Result

Figure 2. Sample pivot table

v In this example, pivot table output is routed to an external HTML file using OMS (Output
Management System). The OMS command specifies that only tables with a table subtype of
pivotTableDemo (to be defined below) will be included in the output. It also specifies the path to the
output file and that the output will be rendered in HTML.
v The command syntax for the OMS command is submitted to IBM SPSS Statistics. This starts an OMS
session. The session is closed with the OMSEND command, which then writes the output to the
destination file.
Note: As an alternative to routing output with OMS, you can also specify output formats and
destinations using an overloaded form of the [Link] method that accepts a string with
output specifications. OMS offers greater flexibility but, for simple applications, specifying output on
the start method may be sufficient.
v To create a pivot table, you create an instance of the PivotTable class. The arguments are as follows:
cells. This argument specifies the values for the cells of the pivot table, and must be given as a
2-dimensional array, where each element of the array specifies the cells in a given row of the pivot
table. Only Double and String objects can be specified in this array.
rowLabels. A 1-dimensional array of categories for the row dimension. Only Double and String objects
can be specified in this array.
colLabels. A 1-dimensional array of categories for the column dimension. Only Double and String
objects can be specified in this array.
title. A string specifying the title of the table.
templateName A string that specifies the OMS (Output Management System) table subtype for this
table. This value must begin with a letter, and have a maximum of 64 bytes. The table subtype can be
used on the SUBTYPES keyword of the OMS command, as done here, to include this pivot table in the
output for a specified set of subtypes.
Note: By creating the pivot table instance within a startProcedure-endProcedure block, you can
associate the pivot table output with a command name, as for pivot table output produced by syntax
commands. The command name is the argument to the startProcedure function and can used on the
COMMANDS keyword of the OMS command to include the pivot table in the output for a specified set of
commands (along with optionally specifying a subtype as discussed above).
outline. A string that specifies an optional outline title for the table. When routing output to an SPV
file with OMS, or generating output in the Viewer for an extension command implemented in Java, the
pivot table will be nested under an item with the outline name. When output is routed to OMS in
OXML format, the outline title specifies a heading tag that will contain the output for the pivot table.
caption. A string that specifies a table caption.
rowDim. A string specifying the label for the row dimension.
columnDim. A string specifying the label for the column dimension.
hideRowDimTitle. A boolean specifying whether to hide the row dimension title.
hideRowDimLabels. A boolean specifying whether to hide the row labels.

20 Java Plug-in User Guide for IBM SPSS Statistics


hideColDimTitle. A boolean specifying whether to hide the column dimension title.
hideColDimLabels. A boolean specifying whether to hide the column labels.
format. Specifies the format to be used for displaying numeric values, including cell values, row labels,
and column labels. The argument is specified as a FormatSpec enum.

Creating text blocks


Text blocks are created with the addTextBlock method in the StatsUtil class.
String[] command={"OMS SELECT TEXTS",
"/IF LABELS = [’Text block name’]",
"/DESTINATION FORMAT=HTML OUTFILE=’/output/[Link]’."
};
[Link](command);
[Link]("demo");
[Link]("Text block name", "The first line of text.");
[Link]("Text block name", "The second line of text.",1);
[Link]();
[Link]("OMSEND.");
v In the common case that you're creating text blocks along with other output such as pivot tables, you'll
probably be routing the output with OMS (unless you are creating text blocks for an extension
command implemented in Java). To route text block output to OMS, you include the TEXTS keyword on
the SELECT subcommand of the OMS command, as in this example. As specified on the OMS command,
the text block in this example will be routed to an HTML file.
v The addTextBlock method must be called within a startProcedure - endProcedure block, as shown in
this example. startProcedure - endProcedure blocks define a set of output (pivot tables and text
blocks) that is associated with a name (in this example, demo). When routing output to a Viewer (spv)
file with OMS or creating output for an extension command implemented in Java, startProcedure -
endProcedure blocks allow you to group output under a common heading, as is done for the set of
output generated by an IBM SPSS Statistics command.
v The first argument to the addTextBlock method is a string that specifies the name of the text block. The
name can be used on the LABELS keyword of the OMS command, as done here, to limit the textual
output routed to OMS.
v The second argument to the addTextBlock method is the content of the text block as a string.
v You can append additional lines by calling an overloaded version of the addTextBlock method,
supplying the same text block name, the content for the next line, and an integer specifying the
number of lines to skip before the new line. You can also use the escape sequence \n to specify line
breaks, allowing you to specify multiple lines in a single call to addTextBlock.

Creating output for extension commands


Pivot tables and text blocks created from extension commands are displayed in the Viewer by default. If
you are displaying output in the Viewer then you will probably want to group your output under a
common heading. This is done by wrapping the output generation in a startProcedure - endProcedure
block, which is actually required for text blocks but optional for pivot tables. If you don't wrap your
output in a startProcedure - endProcedure block, then your output will be grouped under the heading
UserProcedure in the Viewer. Following is a reworking of the example in “Creating pivot tables” on page
19, but wrapping the pivot table generation in a startProcedure - endProcedure block.
Object[] rowLabels = new Object[] {"row1", "row2"};
Object[] colLabels = new Object[] { "columnA", "columnB"};
Object[][] cells = new Object[][] {{"1A","1B"}, {"2A","2B"}};
String title = "Sample pivot table";
String templateName = "pivotTableDemo";
String outline = "";
String caption = "";
String rowDim = "Row dimension";
String columnDim = "Column dimension";
boolean hideRowDimTitle = false;
boolean hideRowDimLabel = false;
boolean hideColDimTitle = false;
boolean hideColDimLabel = false;
[Link]("Demo");
PivotTable table = new PivotTable(cells, rowLabels, colLabels,
title, templateName, outline, caption, rowDim,

Chapter 6. Creating custom output 21


columnDim, hideRowDimTitle, hideRowDimLabel,
hideColDimTitle, hideColDimLabel, [Link]);
[Link]();
[Link]();
v The argument to the startProcedure method specifies the name associated with the generated output,
and is the name of the heading under which the output is grouped in the Viewer.
v Although not utilized in this example, the outline argument to the PivotTable method specifies a
heading under which the pivot table will appear. This heading will be nested under the heading
specified by the argument to the startProcedure method. When the argument is omitted, as in this
example, the pivot table appears directly under the heading specified by the argument to the
startProcedure method.
v The endProcedure method must be called to end the block.

22 Java Plug-in User Guide for IBM SPSS Statistics


Chapter 7. Deploying an external Java application
A Java application that externally invokes IBM SPSS Statistics through the IBM SPSS Statistics -
Integration Plug-in for Java must be deployed on a machine that has a licensed IBM SPSS Statistics
application. For information about licensing or distribution arrangements, please contact IBM Corp.
directly. Support for the IBM SPSS Statistics - Integration Plug-in for Java was introduced in version 21.

As discussed in Chapter 1, “Getting started with the Integration Plug-in for Java,” on page 1, the JAR file
containing the Java package for the IBM SPSS Statistics - Integration Plug-in for Java is located in the IBM
SPSS Statistics installation directory, so your application must be able to locate this directory. A utility
distributed with the IBM SPSS Statistics - Programmability SDK is provided for this purpose. This
software development kit (SDK) is available from [Link]

The utility provides two means for obtaining the IBM SPSS Statistics installation directory. You can either
run a script which will write the location of the latest installed version of IBM SPSS Statistics to a .ini file,
or you can import a JAR file with methods that will allow you to obtain that location or the locations of
all installed versions of IBM SPSS Statistics (beginning with version 21). The components available with
the utility can be found in the StatisticsUtil folder under the location where you extract the ZIP file
containing the IBM SPSS Statistics - Programmability SDK.

Using an ini file

To write the location of the latest installed version of IBM SPSS Statistics (beginning with version 21) to a
.ini file, run [Link] (for Windows platforms) or [Link] (for non-Windows platforms). The
script writes the location of IBM SPSS Statistics to the file [Link], located in the folder that contains
the script. Specifically, it creates a key-value pair with STATISTICS_PATH as the key and the location as
the value--for example, STATISTICS_PATH=C:\Program Files\IBM\SPSS\Statistics\21. If [Link]
already exists, the script updates the file. If [Link] does not exist, then the script will create it.

Using methods in the JAR file

The file [Link] provides the following two methods in the Utility class:
v getStatisticsLocationLatest. This method returns a string with the path to the latest installed version of
IBM SPSS Statistics, starting with version 21.
v getStatisticsLocationAll. This method returns a string array with the paths to all installed versions of
IBM SPSS Statistics, starting with version 21.

Notes
v For instances of the client version of SPSS Statistics, the term 'latest' means the highest installed
version. For instances of the server version of SPSS Statistics on UNIX platforms, where multiple
instances with the same version number may exist on the same machine, the 'latest' version is the one
with the highest version number and the most recent time stamp.
v If there is both a client and a server version of SPSS Statistics installed as the latest version, then the
path to the server version is the one written to the .ini file or returned by the
getStatisticsLocationLatest method.

23
24 Java Plug-in User Guide for IBM SPSS Statistics
Notices
This information was developed for products and services offered in the U.S.A.

IBM may not offer the products, services, or features discussed in this document in other countries.
Consult your local IBM representative for information on the products and services currently available in
your area. Any reference to an IBM product, program, or service is not intended to state or imply that
only that IBM product, program, or service may be used. Any functionally equivalent product, program,
or service that does not infringe any IBM intellectual property right may be used instead. However, it is
the user's responsibility to evaluate and verify the operation of any non-IBM product, program, or
service.

IBM may have patents or pending patent applications covering subject matter described in this
document. The furnishing of this document does not grant you any license to these patents. You can send
license inquiries, in writing, to:

IBM Director of Licensing


IBM Corporation
North Castle Drive
Armonk, NY 10504-1785
U.S.A.

For license inquiries regarding double-byte (DBCS) information, contact the IBM Intellectual Property
Department in your country or send inquiries, in writing, to:

Intellectual Property Licensing


Legal and Intellectual Property Law
IBM Japan Ltd.
1623-14, Shimotsuruma, Yamato-shi
Kanagawa 242-8502 Japan

The following paragraph does not apply to the United Kingdom or any other country where such
provisions are inconsistent with local law: INTERNATIONAL BUSINESS MACHINES CORPORATION
PROVIDES THIS PUBLICATION "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR
IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Some
states do not allow disclaimer of express or implied warranties in certain transactions, therefore, this
statement may not apply to you.

This information could include technical inaccuracies or typographical errors. Changes are periodically
made to the information herein; these changes will be incorporated in new editions of the publication.
IBM may make improvements and/or changes in the product(s) and/or the program(s) described in this
publication at any time without notice.

Any references in this information to non-IBM Web sites are provided for convenience only and do not in
any manner serve as an endorsement of those Web sites. The materials at those Web sites are not part of
the materials for this IBM product and use of those Web sites is at your own risk.

IBM may use or distribute any of the information you supply in any way it believes appropriate without
incurring any obligation to you.

25
Licensees of this program who wish to have information about it for the purpose of enabling: (i) the
exchange of information between independently created programs and other programs (including this
one) and (ii) the mutual use of the information which has been exchanged, should contact:

IBM Software Group


ATTN: Licensing
200 W. Madison St.
Chicago, IL; 60606
U.S.A.

Such information may be available, subject to appropriate terms and conditions, including in some cases,
payment of a fee.

The licensed program described in this document and all licensed material available for it are provided
by IBM under terms of the IBM Customer Agreement, IBM International Program License Agreement or
any equivalent agreement between us.

Any performance data contained herein was determined in a controlled environment. Therefore, the
results obtained in other operating environments may vary significantly. Some measurements may have
been made on development-level systems and there is no guarantee that these measurements will be the
same on generally available systems. Furthermore, some measurements may have been estimated through
extrapolation. Actual results may vary. Users of this document should verify the applicable data for their
specific environment.

Information concerning non-IBM products was obtained from the suppliers of those products, their
published announcements or other publicly available sources. IBM has not tested those products and
cannot confirm the accuracy of performance, compatibility or any other claims related to non-IBM
products. Questions on the capabilities of non-IBM products should be addressed to the suppliers of
those products.

All statements regarding IBM's future direction or intent are subject to change or withdrawal without
notice, and represent goals and objectives only.

This information contains examples of data and reports used in daily business operations. To illustrate
them as completely as possible, the examples include the names of individuals, companies, brands, and
products. All of these names are fictitious and any similarity to the names and addresses used by an
actual business enterprise is entirely coincidental.

COPYRIGHT LICENSE:

This information contains sample application programs in source language, which illustrate programming
techniques on various operating platforms. You may copy, modify, and distribute these sample programs
in any form without payment to IBM, for the purposes of developing, using, marketing or distributing
application programs conforming to the application programming interface for the operating platform for
which the sample programs are written. These examples have not been thoroughly tested under all
conditions. IBM, therefore, cannot guarantee or imply reliability, serviceability, or function of these
programs. The sample programs are provided "AS IS", without warranty of any kind. IBM shall not be
liable for any damages arising out of your use of the sample programs.

Each copy or any portion of these sample programs or any derivative work, must include a copyright
notice as follows:

© your company name) (year). Portions of this code are derived from IBM Corp. Sample Programs.

© Copyright IBM Corp. _enter the year or years_. All rights reserved.

26 Java Plug-in User Guide for IBM SPSS Statistics


Trademarks
IBM, the IBM logo, and [Link] are trademarks or registered trademarks of International Business
Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be
trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at
“Copyright and trademark information” at [Link]/legal/[Link].

Adobe, the Adobe logo, PostScript, and the PostScript logo are either registered trademarks or trademarks
of Adobe Systems Incorporated in the United States, and/or other countries.

Intel, Intel logo, Intel Inside, Intel Inside logo, Intel Centrino, Intel Centrino logo, Celeron, Intel Xeon,
Intel SpeedStep, Itanium, and Pentium are trademarks or registered trademarks of Intel Corporation or its
subsidiaries in the United States and other countries.

Linux is a registered trademark of Linus Torvalds in the United States, other countries, or both.

Microsoft, Windows, Windows NT, and the Windows logo are trademarks of Microsoft Corporation in the
United States, other countries, or both.

UNIX is a registered trademark of The Open Group in the United States and other countries.

Java and all Java-based trademarks and logos are trademarks or registered trademarks of Oracle and/or
its affiliates.

Notices 27
28 Java Plug-in User Guide for IBM SPSS Statistics
Index
D
data
appending cases 9, 12
creating new variables 9, 11
reading active dataset from Java 9
dictionary
reading dictionary information from
Java 7

J
Java
DataUtil class 9
evaluateXPath method 15
Submit method 5

O
output
reading output results from Java 15
OXML
reading output XML from Java 15

P
pivot tables 19

R
running command syntax from Java 5

X
XML workspace 15
XPath expressions 15

29
30 Java Plug-in User Guide for IBM SPSS Statistics


Printed in USA

You might also like