Thanks. It seems after much research, this is the only way to really
do it. Using runsyntax in batch will just open multiple instances of
SPSS, eventually resulting in lack of computer resources to continue
operation.
I really wish though that we could specify parameters in the SPS files
so we can just have one 'template' SPS and use production facility to
replace variables with common data; instead, the same SPS file needs
to be created for each sample.
Oh well, can't expect a perfect world. :)
The Production Facility allows you to define a macro that can be used
in the syntax to parameterize it. When you use this, you get prompted
for the macro value when you start the job.
HTH,
Jon Peck
You can, using production mode, specify a substitution parameter which
is specified at run time. The UI calls this a user prompt. Not perfect
but closer to perfect.
Mike
To expand on what Mike said a bit, starting with SPSS 14.0.1, you have
the ability to invoke SPSS with no user interface and feed it commands
and data if you have either the Python plug-in (and Python) installed
or the .NET plugin. In this mode, you do not get SPO file output,
but you use OMS to produce output as html, plain text, xml, ... With
html output, you can get graphic images as well.
If you just want to run the same syntax job you would use in the
normal mode but using this externally driven mode, it is very simple
to wrap the entire block of syntax into your programmability setup
without change, or you can use an INSERT command.
So with this mode, you can then create a bat file or equivalent and
even schedule it with the Windows scheduler.
HTH,
Jon Peck
I resolved this issue my own way. We have over 500 samples that need
to be processed from the same syntax.
1. I created a 'template' syntax file where non-static variables were
marked with an identifier such as %id or %group.
2. Then, I used the SPSS ODBC driver to access our SPSS .sav via PHP
and SQL.
3. In my PHP script, I have a while loop that access each row of
the .sav file, and replaces the values in the template syntax (ie %id
is now the value of 'id' in the database depending on the row values);
this syntax is saved as a file, id_group#.sps
4. SPSS Production Facility has an 'issue' where you have to manually
add one syntax file at a time. Adding 500 syntax files would be a
pain; however, I found a way around this. Since the facility file
(.spp) is a plain text file, opening it up reveals a portion that goes
like this:
INSERT FILE='<path to syntax>' SYNTAX=BATCH ERROR=CONTINUE.
At the end of my PHP script, I generated the "INSERT FILE..." lines
into a separate file and pasted the resulting 500 lines into my
production file and saved it.
5. Ran SPSS Production Facility and opened the production file without
a hitch!
I guess my method is the "quick and dirty way".
> I guess my method is the "quick and dirty way".- Hide quoted text -
>
> - Show quoted text -