You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From the readme: "To use the run selected code in SPSS tool
1.Make sure you have SPSS already running"
If you use the Production Facility, you only use a costly license when you actually run the .sps.
The Production Facility takes an .spj while (which is actually an .xml file) that itself calls one of more .sps files. When you're done, you can use the free smartreader to view the output (.spv).
Code fragment:
stats = r"C:\PROGRA~1\IBM\SPSS\STATIS~1\22\stats.com"
reader = r"C:\PROGRA~1\IBM\SPSS\Smartreader\21\reader.exe"
# this has the locale and locale/codepage setting hard-coded. Not nice, but good enough for my purposes
def create_spj(syntaxPath, outputPath, productionPath):
"""create the SPSS production facility file (.spj)"""
spj_template = '''\
<job xmlns="http://www.ibm.com/software/analytics/spss/xml/production"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" print="false"
syntaxErrorHandling="continue" syntaxFormat="interactive" unicode="false"
xsi:schemaLocation="http://www.ibm.com/software/analytics/spss/xml/production
http://www.ibm.com/software/analytics/spss/xml/production/production-1.4.xsd">
<locale charset="windows-1252" country="NL" language="nl"/>
<output outputFormat="viewer" outputPath="%(outputPath)s"/>
<syntax syntaxPath="%(syntaxPath)s"/>
</job>'''
logger.debug("create .spj:" + spj_template % locals())
with open(productionPath, "w") as f:
f.write(spj_template % locals())
def run_production_facility(stats, productionPath):
"""run the SPSS production facility"""
cwd = dirname(abspath(productionPath))
cmds = [stats, "-production", "silent", "-nologo", productionPath]
logger.info(".spj runnen: %s", " ".join(cmds))
proc = Popen(cmds, cwd=cwd, stdout=PIPE, stderr=PIPE)
#proc.wait()
proc.communicate()
errors = proc.stderr.read()
if errors:
logger.error(error)
output = proc.stdout.read()
if output:
logger.warning(output)
if __name__ == '__main__':
create_spj(syntaxPath, outputPath, productionPath)
run_production_facility(stats, productionPath)
The text was updated successfully, but these errors were encountered:
Hi,
From the readme: "To use the run selected code in SPSS tool
1.Make sure you have SPSS already running"
If you use the Production Facility, you only use a costly license when you actually run the .sps.
The Production Facility takes an .spj while (which is actually an .xml file) that itself calls one of more .sps files. When you're done, you can use the free smartreader to view the output (.spv).
Code fragment:
The text was updated successfully, but these errors were encountered: