Solved – How to import and run a model with SPSS

I have exported a model using SPSS (it was generated by the automatic linear model generator).

My question is simple but I cannot find the answer to it:
how do I import and run this model from the exported xml file?

Thanks in advance.

Look at the scoring wizard on the Utilities menu. It will take the xml you exported and help you apply it to new data. That was introduced IIRC in V19. Before that you would have needed Statistics Server to do this.

The function used by both the Scoring Wizard and Server is called applymodel. Here is an extract of the help for it.

ApplyModel. ApplyModel(handle, "function", value). Numeric. Applies a particular scoring function to the input case data using the model specified by handle and where "function" is one of the following string literal values enclosed in quotes: predict, stddev, probability, confidence, nodeid, cumhazard, neighbor, distance. The model handle is the name associated with the external XML file, as defined on the MODEL HANDLE command. The optional third argument applies when the function is "probability", "neighbor", or "distance". For "probability", it specifies a category for which the probability is calculated. For "neighbor" and "distance", it specifies a particular neighbor (as an integer) for nearest neighbor models. ApplyModel returns system-missing if a value can not be computed. String values must be enclosed in quotes. For example, ApplyModel(name1, ‘probability’, ‘reject’), where name1 is the model’s handle name and ‘reject’ is a valid category for a target variable that is a string.

Regards, Jon Peck

Similar Posts:

Rate this post

Leave a Comment