Presumably the dataset has already been opened in the Python code. Then you can just submit an INSERT command to apply your syntax. (INCLUDE is obsolete but would probably work here, too.)
That is, you would do
spss.Submit("INSERT 'filespec'")
or, you could read the syntax file into your Python program and submit it that way.
cmds = file("c:/temp/somesyntax.sps").readlines()
spss.Submit(cmds)
If you were going to make substitutions in the syntax stream differently for different datasets, the second approach would make more sense.
HTH,
Jon Peck
-----Original Message-----
From: SPSSX(r) Discussion [mailto:
[hidden email]] On Behalf Of Georg Maubach
Sent: Friday, May 11, 2007 5:47 AM
To:
[hidden email]
Subject: [SPSSX-L] Include of Syntax file in Python program
Hi All,
We have written a syntax program that need to be run on a hole bunch of
datasets. Which datasets to use shall be determined with Python (script
is already done) from the datasets that can be found in a given
directory. Then the complete syntax program shall be run on these
datasets successively. Is there a function like INCLUDE in Python that
makes it possible to run a syntax on a given set of datasets or do we
need to include the hole syntax program in a command like
Spss.submit(
"""
Complete syntax program
""") ?
Best regards
Georg Maubach
Market Analyst
Deutsche Post World Net
Business Consulting GmbH
Market Research Service Center