Within SPSS, you can use code generated by the scoring wizard for this, but that requires SPSS. All the information you need is in the XML file, but you would have to parse that and write the code to carry out the calculations. The xml file or cftree files are rather complex, so this task would require significant expertise to carry out. However, the XML file complies with the PMML standard, so apps that handle PMML could be used. In Excel, you would need to write VBA code to process this or find a third-party add-in.
Original Message:
Sent: Mon May 12, 2025 07:52 AM
From: Kedar Patgaonkar
Subject: 2-Step Cluster- Need to create Typing tool for new data
Hi Gunilla,
Thanks for taking time out to explore this. Typing tool is for external clients to explore, and they may not have SPSS on the machines. Hence it makes it slightly challenging to do it in SPSS. Anyways will wait for few more answers. Thanks again. Really appreciate it.
Best Regards,
Kedar
------------------------------
Kedar Patgaonkar
Original Message:
Sent: Mon May 12, 2025 07:37 AM
From: Gunilla Rudander
Subject: 2-Step Cluster- Need to create Typing tool for new data
Hi Kedar, I haven't used XML-model within Excel so I asked chatGPT about it and got an answer that you should use the XML-file inside SPSS Statistics, which mean that you first has to read in the Excel data into SPSS Statistics and then run the XML-model. But I am not sure how to do that step, because in the answer below from "How to apply the saved model" I cannot find this command. So I hope anyone else know that? /Gunilla Rudander
Answer from chat GPT:
You can use a TwoStep Cluster model saved in SPSS as an XML file to classify new cases, but this must be done inside SPSS - it is not possible to apply the XML file directly in Excel.
The XML file saved by SPSS during a TwoStep Cluster analysis is an internal model format that can only be used within SPSS Statistics - there is no built-in support in Excel for interpreting or applying this type of model.
π Limitations:
- The XML file contains the model logic (cluster centers, variable types, category groupings, etc.) in a format that only SPSS understands.
- Excel does not have an engine to interpret SPSS models or to replicate SPSS classifications.
- TwoStep is a relatively complex algorithm that is not easily translated into Excel formulas manually.
β
How to apply the saved model in SPSS
To classify new data (e.g., from an Excel file), follow these steps inside SPSS:
- Load your new data
Go to File > Open > Data and select your Excel file. Make sure the variables have the same names and formats as those used when the model was created. - Apply the saved model
- Go to Analyze > Classify > Apply Saved Model.
- Select the file cluster_model.xml.
- SPSS will match the variables in the model with those in the dataset.
- Specify a new variable name for the Predicted cluster (e.g., pred_cluster).
- Click OK.
SPSS will add a new variable to your dataset indicating the predicted cluster for each row.
- Export to Excel (if needed)
If you want to work with the results in Excel afterward, go to File > Export > Excel,
------------------------------
Gunilla Rudander
Original Message:
Sent: Fri May 09, 2025 02:31 AM
From: Kedar Patgaonkar
Subject: 2-Step Cluster- Need to create Typing tool for new data
Hi ,
I have run 2-step cluster and got the required outputs. I have also exported model in XML. I would like to creat tryping tool using this model to classify new data. Has anyopne worked on it. Can you anyone please guide me on this. Typing tool needs to have user firndly interface since is it going to be used by non-technical people. Please help.
Best Regards,
Kedar
------------------------------
Kedar Patgaonkar
------------------------------