How to let SPSS run at the back

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

How to let SPSS run at the back

albert_sun
Hi, all:

I am running a SPSS synatx (takes some time), and the data constantly pop up to the front. I am thinking of if there is any way to put SPSS running at the back so that I could do other things while it is running.
Reply | Threaded
Open this post in threaded view
|

Re: How to let SPSS run at the back

Jon K Peck
The best way would be to run the job via Python in external mode if you have installed the Python Essentials.  That not only eliminates the gui; it also removes the overhead of updating the Data Editor whenever things change, so it can speed things up considerably for certain kinds of jobs.  It is very easy to convert a syntax file to an external mode job.  Suppose your complete syntax is in a file named myjob.sps in directory c:\mysyntax.
To run as a Python job, you would do this after starting Python.

import spss
spss.SetOutput("off")
spss.Submit(r"""OMS SELECT ALL/DESTINATION OUTFILE="c:/myoutput/somefile.spv" FORMAT=SPV."""
spss.Submit(r"""INSERT FILE="c:/mysyntax/myjob.sps".""")
spss.Submit("""OMSEND""")

Of course you can also move the DE window so that the title bar barely shows at the bottom, and it won't bother  you.

With Statistics Server, you can actually detach from a production-mode job and let it run on the server box and pick up the output later.

  HTH,


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




From:        albert_sun <[hidden email]>
To:        [hidden email],
Date:        10/27/2013 05:47 PM
Subject:        [SPSSX-L] How to let SPSS run at the back
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Hi, all:

I am running a SPSS synatx (takes some time), and the data constantly pop up
to the front. I am thinking of if there is any way to put SPSS running at
the back so that I could do other things while it is running.



--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/How-to-let-SPSS-run-at-the-back-tp5722749.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
|

SV: How to let SPSS run at the back

Eero Olli
In reply to this post by albert_sun
Hi,

I have a daily windows batch job which runs four SPSS production facility scripts.  This will run in one cmd promt window, no SPSS windows are opened. One should not work on SPSS while this script is running. Therefore it is started by windows as a planned task every night at 22:00.

The script below should be saved with the lastname cmd. You need to edit lines 12-14, 39, 46, 53 and 60 to adapt it to your own setup and to name the production facility scripts you want to run.

Best,
Eero


:: made for Windows 7 and SPSS 21 by Eero Olli.
:: Edited 15.09.2011 to work on portable computers.
:: upgraded to v20 15.03.2012
:: upgraded to SPSS v21 05.06.2013

@ECHO off
ECHO  Running now M:\dokumentasjon\SPSS-produksjon\update all SPSSv21.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\21
set program="%SPSSlocation%\stats.exe"

:: The structure of the script
ECHO ON
call :_timestamp1
ECHO off
call :_KillSPSS
call :_chkspssw
call :_location
ECHO ON
call :_update1
call :_update2
call :_update3
call :_update4
call :_KillSPSS
call :_timestamp2
GOTO :EOF

:: the components which are called above:
:: order of components does not matter below.

:_update1
set skript="oppdater LDOsaker - del 1 SQLwebsak.spj"
CALL :_chkscript
ECHO Grab data from SQL server and other sources
IF exist %skript% (start /wait "SPSS" %program% %skript% -production)
GOTO :EOF

:_update2
set skript="M:\dokumentasjon\SPSS-produksjon\oppdater LDOsaker - del 2 skjemaer.spj"
CALL :_chkscript
ECHO Update data from SelectSurvey forms
IF exist %skript% (start /wait "SPSS" %program% %skript% -production)
GOTO :EOF

:_update3
set skript="M:\dokumentasjon\SPSS-produksjon\oppdater LDOsaker - del 3 koble.spj"
CALL :_chkscript
ECHO Update join all datasources to one big file and copy parts to SQL and ACCESS
IF exist %skript% (start /wait "SPSS" %program% %skript% -production)
GOTO :EOF

:_update4
set skript="M:\dokumentasjon\SPSS-produksjon\oppdater LDOsaker - del 4 - tabeller.spj"
CALL :_chkscript
ECHO Update all lists, tables and figures
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 in use
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

:_timestamp1
ECHO.
ECHO script started at %date% %time%
ECHO.
C:\Python27\python.exe m:\dokumentasjon\python\beep_ok.py
GOTO :EOF


:_timestamp2
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








.

-----Opprinnelig melding-----
Fra: albert_sun [mailto:[hidden email]]
Sendt: 28. oktober 2013 00:47
Emne: How to let SPSS run at the back

Hi, all:

I am running a SPSS synatx (takes some time), and the data constantly pop up to the front. I am thinking of if there is any way to put SPSS running at the back so that I could do other things while it is running.



--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/How-to-let-SPSS-run-at-the-back-tp5722749.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: How to let SPSS run at the back

Albert-Jan Roskam
In reply to this post by Jon K Peck
I recently tried this (I hope I am correct with the quotes):
python -c "import spss; spss.Submit(""insert file = 'c:/temp/mysyntax.sps'."")"

That assumes that there is an OUTPUT SAVE command somewhere (e.g. at the end) in the syntax. Using  spss.SetOutput("off") might still be a good idea.

Regards,
Albert-Jan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a
fresh water system, and public health, what have the Romans ever done for us?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

--------------------------------------------
On Mon, 10/28/13, Jon K Peck <[hidden email]> wrote:

 Subject: Re: [SPSSX-L] How to let SPSS run at the back
 To: [hidden email]
 Date: Monday, October 28, 2013, 2:05 AM

 The best
 way would be to run the job via
 Python in external mode if you have installed the Python
 Essentials.  That
 not only eliminates the gui; it also removes the overhead of
 updating the
 Data Editor whenever things change, so it can speed things
 up considerably
 for certain kinds of jobs.  It is very easy to convert
 a syntax file
 to an external mode job.  Suppose your complete syntax
 is in a file
 named myjob.sps in directory c:\mysyntax.

 To run as a Python job, you
 would do
 this after starting Python.



 import spss

 spss.SetOutput("off")

 spss.Submit(r"""OMS SELECT
 ALL/DESTINATION OUTFILE="c:/myoutput/somefile.spv"
 FORMAT=SPV."""

 spss.Submit(r"""INSERT
 FILE="c:/mysyntax/myjob.sps".""")

 spss.Submit("""OMSEND""")



 Of course you can also move
 the DE window
 so that the title bar barely shows at the bottom, and it
 won't bother  you.



 With Statistics Server, you
 can actually
 detach from a production-mode job and let it run on the
 server box and
 pick up the output later.



   HTH,





 Jon Peck (no "h") aka Kim

 Senior Software Engineer, IBM

 [hidden email]

 phone: 720-342-5621









 From:

  albert_sun
 <[hidden email]>

 To:

  [hidden email],


 Date:

  10/27/2013
 05:47 PM

 Subject:

    [SPSSX-L] How
 to let SPSS run at the back

 Sent by:

    "SPSSX(r)
 Discussion" <[hidden email]>








 Hi, all:



 I am running a SPSS synatx (takes some time), and the data
 constantly pop
 up

 to the front. I am thinking of if there is any way to put
 SPSS running
 at

 the back so that I could do other things while it is
 running.







 --

 View this message in context: http://spssx-discussion.1045642.n5.nabble.com/How-to-let-SPSS-run-at-the-back-tp5722749.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

=====================
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: How to let SPSS run at the back

mils
In reply to this post by Jon K Peck
Hi Jon,

I'm really interested in the script you have posted. I tried to run it in my python shell, but couldn't get it right. It is saying I have a syntax error and highlights the second spss.Submit.

import spss

spss.SetOutput("off")

spss.Submit(r"""OMS SELECT ALL/DESTINATION OUTFILE="C:\Users\JoanC\Desktop\HBV\Wave 2\PRFs\somefile.spv" FORMAT=SPV."""

spss.Submit(r"""INSERT FILE="C:\Users\JoanC\Desktop\HBV\Wave 2\PRFs\tables.sps". """)

spss.Submit("""OMSEND""")



Any ideas?


Thanks in advance.

mils
Reply | Threaded
Open this post in threaded view
|

Re: How to let SPSS run at the back

Rick Oliver-3
You don't have a closing paren on your first spss.Submit

Rick Oliver
Senior Information Developer
IBM Business Analytics (SPSS)
E-mail: [hidden email]




From:        mils <[hidden email]>
To:        [hidden email],
Date:        11/21/2013 10:49 AM
Subject:        Re: How to let SPSS run at the back
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Hi Jon,

I'm really interested in the script you have posted. I tried to run it in my
python shell, but couldn't get it right. It is saying I have a syntax error
and highlights the second spss.Submit.

import spss

spss.SetOutput("off")

spss.Submit(r"""OMS SELECT ALL/DESTINATION
OUTFILE="C:\Users\JoanC\Desktop\HBV\Wave 2\PRFs\somefile.spv" FORMAT=SPV."""

spss.Submit(r"""INSERT FILE="C:\Users\JoanC\Desktop\HBV\Wave
2\PRFs\tables.sps". """)

spss.Submit("""OMSEND""")



Any ideas?


Thanks in advance.





-----
mils
--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/How-to-let-SPSS-run-at-the-back-tp5722749p5723228.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: How to let SPSS run at the back

mils
Wow,

You made my Friday   it worked like a charm.

import spss
spss.SetOutput("off")
spss.Submit(r"""OMS SELECT ALL/DESTINATION OUTFILE="C:\Users\JoanC\Desktop\HBV\Wave 2\PRFs\HBVoutput.spv" FORMAT=SPV.""")
spss.Submit(r"""INSERT FILE="C:\Users\JoanC\Desktop\HBV\Wave 2\PRFs\tables.sps". """)
spss.Submit("""OMSEND""")

I have another request though. I'm running a syntax with lots of tables and each one shows significance levels. Below each table I have a script  to merge significance levels to the main table. See syntax attached.

Could it be possible to merge the tables using python?

Also, the output shows the notes table, but I've hidden that option from the viewer. See output attached.

Could it be possible to hide that option when running the output in python?

Thanks in advance,

mils

syntax_tables_example.sps
output_example.spv
mils
Reply | Threaded
Open this post in threaded view
|

Re: How to let SPSS run at the back

Jon K Peck
SPSSINC MERGE TABLES is actually implemented in Python.  You write a Python autoscript if you wanted to do this merge directly, but it would be a lot of code.

I do not understand this question:

Could it be possible to hide that option when running the output in python?


I see also that the spv file in your link shows all the merges failing.  What is that about?


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




From:        mils <[hidden email]>
To:        [hidden email],
Date:        11/22/2013 06:50 AM
Subject:        Re: [SPSSX-L] How to let SPSS run at the back
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Wow,

You made my Friday   it worked like a charm.

import spss
spss.SetOutput("off")
spss.Submit(r"""OMS SELECT ALL/DESTINATION
OUTFILE="C:\Users\JoanC\Desktop\HBV\Wave 2\PRFs\HBVoutput.spv"
FORMAT=SPV.""")
spss.Submit(r"""INSERT FILE="C:\Users\JoanC\Desktop\HBV\Wave
2\PRFs\tables.sps". """)
spss.Submit("""OMSEND""")

I have another request though. I'm running a syntax with lots of tables and
each one shows significance levels. Below each table I have a script  to
merge significance levels to the main table. See syntax attached.

Could it be possible to merge the tables using python?

Also, the output shows the notes table, but I've hidden that option from the
viewer. See output attached.

Could it be possible to hide that option when running the output in python?

Thanks in advance,

mils

syntax_tables_example.sps
<
http://spssx-discussion.1045642.n5.nabble.com/file/n5723248/syntax_tables_example.sps>
output_example.spv
<
http://spssx-discussion.1045642.n5.nabble.com/file/n5723248/output_example.spv>




-----
mils
--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/How-to-let-SPSS-run-at-the-back-tp5722749p5723248.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: How to let SPSS run at the back

mils
Hi Jon,

ref the question: Could it be possible to hide that option when running the output in python?  I was referring to the notes table. But I think I can live with that...

ref to "the spv file in your link shows all the merges failing" I was hoping someone knew why is giving me that error.

Thanks,
mils
mils
Reply | Threaded
Open this post in threaded view
|

Re: How to let SPSS run at the back

David Marso
Administrator
mils,
Please begin a NEW topic as the core of the question is no longer "How to let SPSS run at the back".
mils wrote
Hi Jon,

ref the question: Could it be possible to hide that option when running the output in python?  I was referring to the notes table. But I think I can live with that...

ref to "the spv file in your link shows all the merges failing" I was hoping someone knew why is giving me that error.

Thanks,
mils
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?"