Thank you for your quick response! Here are some more details, I hope this isn't too much: I've developed an Excel spreadsheet that when I fill in variable names and parameters from the dataset, Excel produces the SPSS syntax for a series of MIXED models that I just copy and paste into SPSS, and viola! I have all the information I need, including MLM assumptions assessment, finding/removing extreme outliers (beyond IQR x 3.0), and getting all the fixed/random effects and their coefficients and significance for the variable relationships. It works. The issue is now streamlining due to a need to process up to 2,000 MIXED models in an iterative process as recommended by the multilevel modelling (MLM) literature. I currently have the SPSS syntax in four sections, going back and forth with Excel to do some of the processing before proceeding to the next section, and I have OMS code in the syntax to create new variables for the Level-2 random effects (Intercepts and slopes).
The current syntax processor works well, but I now need to take the 4 sections and combine them into one. My main issue at the moment is the desire to calculate the upper and lower IQR fence values in specific variables (at the IQR x 1.5 and IQR x 3.0 fences), to identify and FILTER out the extreme outliers. I currently take the IQR, 25, 50, 75 quartile values from SPSS, copy and paste into Excel, and Excel produces the SPSS syntax to correctly filter out the extreme outliers, which appears to work perfectly. I would like to calculate these values within the syntax in SPSS automatically, and not in Excel. This would allow me to combine sections and further automate the overall process. I don't have any Python experience, and I am already wrestling code between SPSS syntax, Excel VBA, and MATLAB. I'd prefer to keep programming directly with SPSS syntax, if possible. Thank you for your help!
------------------------------
Mark Sloan
------------------------------
Original Message:
Sent: Mon June 17, 2024 09:08 PM
From: Jon Peck
Subject: Calculating IQR Fence Values without Generating a Table
When you say you are manually pulling these values, have you considered using OMS to capture a table of what you need? That could be directly exported to Excel or merged in another way with the main dataset. Constructing the syntax for this dynamically could be done with the macro facility or, better, a short bit of Python code. I can help with that if you can provide more details..
--
Original Message:
Sent: 6/17/2024 8:22:00 PM
From: Mark Sloan
Subject: Calculating IQR Fence Values without Generating a Table
I am automating SPSS analysis through development of an Excel-based syntax-generator and SPSS results-processor. I need to automatically calculate IQR-based (interquartile) upper and lower fences in SPSS. I currently use Excel to easily calculate fence values copying over SPSS-generated Frequencies-Statistics tables with quartiles (25, 50, 75), from syntax pasted from 'Analyze > Descriptive Statistics > Explore...'. However, this is proving very inefficient for processing 2,000 multi-stage MIXED models.
I request help to identify how to calculate single value variables in SPSS for the 25th and 75th quartiles (and then to calculate IQR and upper and lower fence values (IQR x 3.0)), without manually pulling the results from SPSS Statistics and Descriptives tables. Everything online points to using 'Analyze > Descriptive Statistics > Explore...", but this does not efficiently work for my situation. Instead, is there a way to use 'Transform > Compute Variable...' to generate syntax that calculates the quartiles and IQR fences for a variable as new single value variables in the dataset, without taking a detour to Excel?
------------------------------
Mark Sloan
------------------------------