Macro simulation automation

Moderators: statman, Analyst Techy, andris, Fierce, GerineL, Smash

Posts: 8
Joined: Thu Jun 07, 2012 9:50 pm

Macro simulation automation

Postby jstauss » Thu Oct 24, 2013 3:34 pm

Hi all,

I have a seemingly complicated problem (at least to this SPSS user :? ). I am running a simulation through a macro to create Boolean predictions. The setup is as follows: I have a base file with information for each record. I run the simulation once (without running the macro) to get the first predictions. This will give me an individual prediction for each record (there are four total predictions; in other words, I am creating four new variables). At the moment, I aggregate these predictions and send them to a temporary file. Then, I append what is in the temporary file to my actual output file which will eventually contain all my predictions.

After I first run through the simulation I end up with my base file, a temp file with one row of aggregated predictions, and another file which contains the first row of predictions. I then define the macro with the same language I used to create the above files. I run it and it and have it set up in such a way that it will automatically run 100 times. This will return a file with 100 rows of aggregated predictions.

This is where the problem lies: I do not want a file of 100 aggregate predictions; I want a file with individual level data for every prediction. However, I am unsure as to how the mechanics of this would work. Either I would need to have the simulation repeat for every record and append new predictions for every record into one file with some sort of flag indicating which simulation iteration it was, but this would create an incredibly tall table (I could be working with either 100k to millions of records here). Or, I could could somehow create dynamically updating variables that will be tagged with a suffix for the simulation iteration. This would create a wide table where the new predictions would be merged into the file. I think the second option makes the most sense. I've thought of integrating a Python program in the syntax to somehow dynamically update the prediction variable names, but I'm an amateur Python programmer at best. I've got more of a background in statistics.

If anyone has any ideas or knows of any SPSS commands that my help, it would be very much appreciated.

Thank you!
Posts: 116
Joined: Sat Oct 06, 2012 6:21 am

Re: Macro simulation automation

Postby » Sat Oct 26, 2013 5:58 am

If you need some assistance with Python for SPSS, feel free to contact me. Also, check out my website, it may be helpful.
Kind regards,

Ruben Geert van den Berg
Posts: 2760
Joined: Tue Jun 12, 2007 12:08 pm
Location: Florida, USA

Re: Macro simulation automation

Postby statman » Sat Oct 26, 2013 12:08 pm

What SPSS version are you running
See the note below

NOTE: Please read the Posting Guidelines and always tell us your OS, the SPSS version and information about your study and data!

Statistical Services
Posts: 8
Joined: Thu Jun 07, 2012 9:50 pm

Re: Macro simulation automation

Postby jstauss » Mon Oct 28, 2013 4:45 pm

I am running SPSS version 20.

And thank you, pythonforspss. I'll check out your site and be in contact.

Who is online

Users browsing this forum: No registered users and 2 guests