executing an SPSS syntax program automatically

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

executing an SPSS syntax program automatically

drfg2008
SPSS20 / Windows

Need some extra help:

I have a syntax (pregame_1018_001.sps / 43k) and want it to run automatically over night.

Under UTILITIES - PRODUCTION FACILITIY - NEW ...

I created an spj file: StatisticsJob_1018_001.spj (1k)

Then I created a (basic) task under Windows.

However, the file does not run. Also, when I doubleclick on the file StatisticsJob_1018_001.spj then SPSS starts, but does not execute the program.


Dr. Frank Gaeth

Reply | Threaded
Open this post in threaded view
|

Re: executing an SPSS syntax program automatically

David Marso
Administrator
Well Frank,
What exactly are the contents of "StatisticsJob_1018_001.spj".
Maybe you haven't created the job correctly (ie it is empty).
If it doesn't run unscheduled then it certainly won't run scheduled.
---------------
drfg2008 wrote
SPSS20 / Windows

Need some extra help:

I have a syntax (pregame_1018_001.sps / 43k) and want it to run automatically over night.

Under UTILITIES - PRODUCTION FACILITIY - NEW ...

I created an spj file: StatisticsJob_1018_001.spj (1k)

Then I created a (basic) task under Windows.

However, the file does not run. Also, when I doubleclick on the file StatisticsJob_1018_001.spj then SPSS starts, but does not execute the program.
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: executing an SPSS syntax program automatically

drfg2008
I can run the StatisticsJob_1018_001.spj  File from SPSS. Then everything works fine.

However, when I simply doubleclick on the file, SPSS opens - but nothing happens.

And when I schedule a job, nothing else is done but starting StatisticsJob_1018_001.spj (like doubleclicking - I presume). And nothing happens. That's the problem.



******************
Dr. Frank Gaeth

Reply | Threaded
Open this post in threaded view
|

Re: executing an SPSS syntax program automatically

David Marso
Administrator
"doubleclick on the file, SPSS opens - but nothing happens. "

Maybe nothing is supposed to happen.
What makes you think it should?
Obviously spj has some association with SPSS.  
I don't know how .spj is associated with the Production Mode application.
I presume it takes command line arguments (at least I believe it used to)
Does something like "spssprod StatisticsJob_1018_001.spj "
work from the command line?
Personally I never bothered with it.
If you know a little programming you can build your own.
--
drfg2008 wrote
I can run the StatisticsJob_1018_001.spj  File from SPSS. Then everything works fine.

However, when I simply doubleclick on the file, SPSS opens - but nothing happens.

And when I schedule a job, nothing else is done but starting StatisticsJob_1018_001.spj (like doubleclicking - I presume). And nothing happens. That's the problem.



******************
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: executing an SPSS syntax program automatically

Jon K Peck
In reply to this post by drfg2008
The production facility should start with a special command line.  You can put this into a bat file or other command line friendly file.  It should read something like this.
c:\spss20\stats.exe -production c:\data\Statisticsjob.spj
There are other options available for distributed mode, symbols defined at runtime, etc.  See the topic "command line" in the help for details.

HTH,

Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
new phone: 720-342-5621




From:        drfg2008 <[hidden email]>
To:        [hidden email]
Date:        04/11/2012 07:14 AM
Subject:        Re: [SPSSX-L] executing an SPSS syntax program automatically
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




I can run the StatisticsJob_1018_001.spj  File from SPSS. Then everything
works fine.

However, when I simply doubleclick on the file, SPSS opens - but nothing
happens.

And when I schedule a job, nothing else is done but starting
StatisticsJob_1018_001.spj (like doubleclicking - I presume). And nothing
happens. That's the problem.



******************

-----
Dr. Frank Gaeth
FU-Berlin

--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/executing-an-SPSS-syntax-program-automatically-tp5629927p5632793.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD


Reply | Threaded
Open this post in threaded view
|

Re: executing an SPSS syntax program automatically

Eero Olli
In reply to this post by drfg2008

Hi Frank,

 

It is possible and superbly useful to run productionscripts automatically.  I use Windows 7 scheduled tasks to run a windows cmd script every night: The script reads new data, washes it, inserts it into a database, and produces new statistics published in html or excel.  I have divided the jobs into four productionscripts, even if they are normally run consecutively.  I are have included below the actual cmd-script used, which includes some rudimentary checks and error handling.  It will also kill any instances of SPSS that are running, to insure that none of the datafiles are in use, when they are supposed to be updated.  The GOTO :EOF  (=go to end of file) ensures that only those sections that are called are processed.  I hope it makes sense.

 

Best,

Eero Olli

 

:: made for Windows 7 and SPSS 19 by Eero Olli. May 2011.

:: Edited 15.09.2011 11:07:03 to work on portable computers.

:: upgraded to v20 15.03.2012

 

@ECHO off

ECHO  M:\dokumentasjon\SPSS-produksjon\oppdater LDOsaker alt SPSSv20.cmd

 

:: These variables need to be changed when the setup is changed

set scriptdrive=M:

set scriptfolder=dokumentasjon\SPSS-produksjon\

set SPSSlocation=C:\Programfiler\IBM\SPSS\Statistics\20

set program="%SPSSlocation%\stats.exe"

 

call :_KillSPSS

call :_chkspssw

call :_location

ECHO ON

call :_oppdater1

call :_oppdater2

call :_oppdater3

call :_oppdater4

call :_KillSPSS

call :_timestamp

 

GOTO :EOF

 

:_wait_15

:: a 15 minute brake

ping 1.1.1.1 -n 1 -w 900000 >nul

 

 

:_oppdater1

set skript="oppdater LDOsaker - del 1 SQLwebsak.spj"

CALL :_chkscript

ECHO Henter data fra websak og andre kilder

IF exist %skript% (start /wait "SPSS" %program% %skript% -production)

GOTO :EOF

 

:_oppdater2

set skript="M:\dokumentasjon\SPSS-produksjon\oppdater LDOsaker - del 2 skjemaer.spj"

CALL :_chkscript

ECHO Run Oppdater LDOsaker 2 skjemaene

IF exist %skript% (start /wait "SPSS" %program% %skript% -production)

GOTO :EOF

 

:_oppdater3

set skript="M:\dokumentasjon\SPSS-produksjon\oppdater LDOsaker - del 3 koble.spj"

CALL :_chkscript

ECHO Run Oppdater LDOsaker 3 koble

IF exist %skript% (start /wait "SPSS" %program% %skript% -production)

GOTO :EOF

 

:_oppdater4

set skript="M:\dokumentasjon\SPSS-produksjon\oppdater LDOsaker - del 4 - tabeller.spj"

CALL :_chkscript

ECHO Run Oppdater LDOsaker 4 tabellene

IF exist %skript% (start /wait "SPSS" %program% %skript% -production)

GOTO :EOF

 

 

:_location

%scriptdrive%

cd \%scriptfolder%

ECHO script started %date% %time%

ECHO.

GOTO :EOF

 

 

:_chkscript

ECHO  "**********************"

IF exist %scriptfile% (ECHO productionscript is located ) ELSE GOTO :_problem

GOTO :EOF

 

:_KillSPSS

ECHO make sure that spss production facility is not in use

setlocal

tasklist|find "stats.com">nul

  if %errorlevel% EQU 0 (

    ECHO.

    ECHO    SPSS Production facility is in use.

    ECHO    it will be forcedly shut down. Sorry!

    ECHO.

  taskkill /f /im stats.com

    ) ELSE (

    ECHO.

    echo    SPSS Production facility is available

    ECHO.

    )

endlocal & GOTO :EOF

 

 

:_chkspssw

ECHO make sure that SPSS is not used

setlocal

tasklist|find "spssengine.exe">nul

  if %errorlevel% EQU 0 (

    ECHO.

    ECHO    SPSS is already in use.

    ECHO    it will be forcedly shut down. Sorry!

    ECHO.

  taskkill /f /im spssengine.exe

    ) ELSE (

    ECHO.

    ECHO    SPSS is available

    ECHO.

    )

endlocal & GOTO :EOF

 

 

 

:_timestamp

ECHO.

ECHO script finished at %date% %time%

ECHO.

C:\Python27\python.exe m:\dokumentasjon\python\beep_ok.py

GOTO :EOF

 

 

:_problem

ECHO  something went wrong.

C:\Python27\python.exe m:\dokumentasjon\python\beep_error.py

pause

exit.

endlocal & GOTO :EOF

 

 

 

Fra: Jon K Peck [mailto:[hidden email]]
Sendt: 11. april 2012 15:51
Emne: Re: executing an SPSS syntax program automatically

 

The production facility should start with a special command line.  You can put this into a bat file or other command line friendly file.  It should read something like this.
c:\spss20\stats.exe -production c:\data\Statisticsjob.spj
There are other options available for distributed mode, symbols defined at runtime, etc.  See the topic "command line" in the help for details.

HTH,

Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
new phone: 720-342-5621




From:        drfg2008 <[hidden email]>
To:        [hidden email]
Date:        04/11/2012 07:14 AM
Subject:        Re: [SPSSX-L] executing an SPSS syntax program automatically
Sent by:        "SPSSX(r) Discussion" <[hidden email]>





I can run the StatisticsJob_1018_001.spj  File from SPSS. Then everything
works fine.

However, when I simply doubleclick on the file, SPSS opens - but nothing
happens.

And when I schedule a job, nothing else is done but starting
StatisticsJob_1018_001.spj (like doubleclicking - I presume). And nothing
happens. That's the problem.



******************

-----
Dr. Frank Gaeth
FU-Berlin

--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/executing-an-SPSS-syntax-program-automatically-tp5629927p5632793.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command.
To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD