Exporting output using syntax

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

Exporting output using syntax

Peters Gj (PSYCHOLOGY)
Dear all,

I have syntax files that save output documents to a folder on the
desktop. These output files contain many reliability analyses. To save
myself time I wrote (or rather, will write after I sent this mail :-))
an Excel file that extracts the data I need and list it in one
convenient, well, list. :-)

However, to be able to do that, I first have to open all output files
and export them to Excel format. Though this is not below me
(bordercase, but still :-)) my neurotic mind can't deal with wasting
time on this repetitive 'grunt work' that could perfectly well be done
by a computer. I'd much rather waste twice the time on writing a generic
piece of code that does that work, because, after all, there is always a
1% chance that I will save myself months of work in the future because I
already have the code.

Soooooooooo, I was wondering, does anybody know how to export output
using the syntax? Or, alternatively, Python, or something else I don't
know yet but want to learn anyway? :-)

Please don't spend time finding out how to do this if you don't already
know, this is no life-or-death situation, it's just me being neurotic
:-)

Thanks in advance, kind regards, and a merry Christmas and a happy new
year,

Gjalt-Jorn

PS: how to save to a folder on the desktop may be a useful trick for
some of you. You can do it like this, using the 'SET variable'
%USERPROFILE%:

OUTPUT SAVE NAME=scratchOutput
       OUTFILE="%USERPROFILE%\Desktop\SPSS
ScratchDir\reliabilities.spo".

I first make the folder using this statement:

HOST COMMAND=['MD "%USERPROFILE%\Desktop\SPSS ScratchDir"'].

Which gives an error if the folder already exists, so you can ignore
that if you run the syntax repeatedly. You could also let SPSS write a
batch file to check this first and only make the folder if need be, of
course.

=====================
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: Exporting output using syntax

Albert-Jan Roskam
Hi Gjalt-Jorn,

Have a look at OMS (output management system) under
'utilities'. A (more flexible) Pythonian solution is
also possible but it requires knowledge of Xpath and
the XML representation of a pivot table.

Cheers!!
Albert-Jan


--- "Peters Gj (PSYCHOLOGY)"
<[hidden email]> wrote:

> Dear all,
>
> I have syntax files that save output documents to a
> folder on the
> desktop. These output files contain many reliability
> analyses. To save
> myself time I wrote (or rather, will write after I
> sent this mail :-))
> an Excel file that extracts the data I need and list
> it in one
> convenient, well, list. :-)
>
> However, to be able to do that, I first have to open
> all output files
> and export them to Excel format. Though this is not
> below me
> (bordercase, but still :-)) my neurotic mind can't
> deal with wasting
> time on this repetitive 'grunt work' that could
> perfectly well be done
> by a computer. I'd much rather waste twice the time
> on writing a generic
> piece of code that does that work, because, after
> all, there is always a
> 1% chance that I will save myself months of work in
> the future because I
> already have the code.
>
> Soooooooooo, I was wondering, does anybody know how
> to export output
> using the syntax? Or, alternatively, Python, or
> something else I don't
> know yet but want to learn anyway? :-)
>
> Please don't spend time finding out how to do this
> if you don't already
> know, this is no life-or-death situation, it's just
> me being neurotic
> :-)
>
> Thanks in advance, kind regards, and a merry
> Christmas and a happy new
> year,
>
> Gjalt-Jorn
>
> PS: how to save to a folder on the desktop may be a
> useful trick for
> some of you. You can do it like this, using the 'SET
> variable'
> %USERPROFILE%:
>
> OUTPUT SAVE NAME=scratchOutput
>        OUTFILE="%USERPROFILE%\Desktop\SPSS
> ScratchDir\reliabilities.spo".
>
> I first make the folder using this statement:
>
> HOST COMMAND=['MD "%USERPROFILE%\Desktop\SPSS
> ScratchDir"'].
>
> Which gives an error if the folder already exists,
> so you can ignore
> that if you run the syntax repeatedly. You could
> also let SPSS write a
> batch file to check this first and only make the
> folder if need be, of
> course.
>
> =====================
> 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
>


Cheers!
Albert-Jan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Did you know that 87.166253% of all statistics claim a precision of results that is not justified by the method employed? [HELMUT RICHTER]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


      ____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping

=====================
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: Exporting output using syntax

Albert-Jan Roskam
In reply to this post by Peters Gj (PSYCHOLOGY)
In addition: the SPSSAux/Python functions
CreateXMLoutput and GetValuesFromXMLWorkspace will
simplify your code somewhat. Interesting stuff!

Albert-Jan

--- "Peters Gj (PSYCHOLOGY)"
<[hidden email]> wrote:

> Dear all,
>
> I have syntax files that save output documents to a
> folder on the
> desktop. These output files contain many reliability
> analyses. To save
> myself time I wrote (or rather, will write after I
> sent this mail :-))
> an Excel file that extracts the data I need and list
> it in one
> convenient, well, list. :-)
>
> However, to be able to do that, I first have to open
> all output files
> and export them to Excel format. Though this is not
> below me
> (bordercase, but still :-)) my neurotic mind can't
> deal with wasting
> time on this repetitive 'grunt work' that could
> perfectly well be done
> by a computer. I'd much rather waste twice the time
> on writing a generic
> piece of code that does that work, because, after
> all, there is always a
> 1% chance that I will save myself months of work in
> the future because I
> already have the code.
>
> Soooooooooo, I was wondering, does anybody know how
> to export output
> using the syntax? Or, alternatively, Python, or
> something else I don't
> know yet but want to learn anyway? :-)
>
> Please don't spend time finding out how to do this
> if you don't already
> know, this is no life-or-death situation, it's just
> me being neurotic
> :-)
>
> Thanks in advance, kind regards, and a merry
> Christmas and a happy new
> year,
>
> Gjalt-Jorn
>
> PS: how to save to a folder on the desktop may be a
> useful trick for
> some of you. You can do it like this, using the 'SET
> variable'
> %USERPROFILE%:
>
> OUTPUT SAVE NAME=scratchOutput
>        OUTFILE="%USERPROFILE%\Desktop\SPSS
> ScratchDir\reliabilities.spo".
>
> I first make the folder using this statement:
>
> HOST COMMAND=['MD "%USERPROFILE%\Desktop\SPSS
> ScratchDir"'].
>
> Which gives an error if the folder already exists,
> so you can ignore
> that if you run the syntax repeatedly. You could
> also let SPSS write a
> batch file to check this first and only make the
> folder if need be, of
> course.
>
> =====================
> 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
>


Cheers!
Albert-Jan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Did you know that 87.166253% of all statistics claim a precision of results that is not justified by the method employed? [HELMUT RICHTER]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


      ____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

=====================
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: Exporting output using syntax

Peters Gj (PSYCHOLOGY)
In reply to this post by Albert-Jan Roskam
Dear Albert-Jan,

Thank you very much for your solution!
It's not .XLS, but text files can easily be imported into Excel (though
it again does require quite a bit of point-and-click :-)). I didn't know
this OMS thing existed, quite interesting! In case anybody else is
interested, this is how you do it:

OMS /SELECT ALL /DESTINATION FORMAT = TABTEXT
  OUTFILE = "some filename (like this one ;-)).txt" /TAG =
"outputToText".

** Do your stuff here.

OMSEND TAG=["outputToText"].

This saves all output generated in between the two OMS commands to the
specified text file in tab-separated format.

Again, Albert-Jan, thank you very much! I will definitely plunge into
XML. Soon. When I have time. Some day. After the PhD :-)

Kind regards,

Gjalt-Jorn
___________________________________________
Gjalt-Jorn Ygram Peters

## Phd. Student
   Department of Work and Social Psychology
   Faculty of Psychology
   University of Maastricht

-----Original Message-----
From: Albert-jan Roskam [mailto:[hidden email]]
Sent: maandag 17 december 2007 13:00
To: Peters Gj (PSYCHOLOGY); [hidden email]
Subject: Re: Exporting output using syntax

Hi Gjalt-Jorn,

Have a look at OMS (output management system) under
'utilities'. A (more flexible) Pythonian solution is
also possible but it requires knowledge of Xpath and
the XML representation of a pivot table.

Cheers!!
Albert-Jan


--- "Peters Gj (PSYCHOLOGY)"
<[hidden email]> wrote:

> Dear all,
>
> I have syntax files that save output documents to a
> folder on the
> desktop. These output files contain many reliability
> analyses. To save
> myself time I wrote (or rather, will write after I
> sent this mail :-))
> an Excel file that extracts the data I need and list
> it in one
> convenient, well, list. :-)
>
> However, to be able to do that, I first have to open
> all output files
> and export them to Excel format. Though this is not
> below me
> (bordercase, but still :-)) my neurotic mind can't
> deal with wasting
> time on this repetitive 'grunt work' that could
> perfectly well be done
> by a computer. I'd much rather waste twice the time
> on writing a generic
> piece of code that does that work, because, after
> all, there is always a
> 1% chance that I will save myself months of work in
> the future because I
> already have the code.
>
> Soooooooooo, I was wondering, does anybody know how
> to export output
> using the syntax? Or, alternatively, Python, or
> something else I don't
> know yet but want to learn anyway? :-)
>
> Please don't spend time finding out how to do this
> if you don't already
> know, this is no life-or-death situation, it's just
> me being neurotic
> :-)
>
> Thanks in advance, kind regards, and a merry
> Christmas and a happy new
> year,
>
> Gjalt-Jorn
>
> PS: how to save to a folder on the desktop may be a
> useful trick for
> some of you. You can do it like this, using the 'SET
> variable'
> %USERPROFILE%:
>
> OUTPUT SAVE NAME=scratchOutput
>        OUTFILE="%USERPROFILE%\Desktop\SPSS
> ScratchDir\reliabilities.spo".
>
> I first make the folder using this statement:
>
> HOST COMMAND=['MD "%USERPROFILE%\Desktop\SPSS
> ScratchDir"'].
>
> Which gives an error if the folder already exists,
> so you can ignore
> that if you run the syntax repeatedly. You could
> also let SPSS write a
> batch file to check this first and only make the
> folder if need be, of
> course.
>
> =====================
> 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
>


Cheers!
Albert-Jan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Did you know that 87.166253% of all statistics claim a precision of
results that is not justified by the method employed? [HELMUT RICHTER]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



________________________________________________________________________
____________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search.
http://tools.search.yahoo.com/newsearch/category.php?category=shopping

=====================
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: Exporting output using syntax

Peck, Jon
In reply to this post by Peters Gj (PSYCHOLOGY)
As Albert mentioned, OMS is your friend.  But there is also an easy way to export your pivot tables to Excel with Python or even SaxBasic.

With Python, you can find a function the spssapp class in the viewer module called ExportDesignatedOutput.

begin program.
import viewer
des = viewer.spssapp()
des.ExportDesignatedOutput(filespec="c:/temp/tables.xls", format="Excel")
end program.

There is also a SaxBasic exporter you can download from SPSS Developer Central (www.spss.com/devcentral)
that has some extra bells and whistles, including exporting each table to a separate sheet in a single Excel file.

HTH,
Jon Peck
(from Brussels)

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Peters Gj (PSYCHOLOGY)
Sent: Monday, December 17, 2007 4:30 AM
To: [hidden email]
Subject: [SPSSX-L] Exporting output using syntax

Dear all,

I have syntax files that save output documents to a folder on the
desktop. These output files contain many reliability analyses. To save
myself time I wrote (or rather, will write after I sent this mail :-))
an Excel file that extracts the data I need and list it in one
convenient, well, list. :-)

However, to be able to do that, I first have to open all output files
and export them to Excel format. Though this is not below me
(bordercase, but still :-)) my neurotic mind can't deal with wasting
time on this repetitive 'grunt work' that could perfectly well be done
by a computer. I'd much rather waste twice the time on writing a generic
piece of code that does that work, because, after all, there is always a
1% chance that I will save myself months of work in the future because I
already have the code.

Soooooooooo, I was wondering, does anybody know how to export output
using the syntax? Or, alternatively, Python, or something else I don't
know yet but want to learn anyway? :-)

Please don't spend time finding out how to do this if you don't already
know, this is no life-or-death situation, it's just me being neurotic
:-)

Thanks in advance, kind regards, and a merry Christmas and a happy new
year,

Gjalt-Jorn

PS: how to save to a folder on the desktop may be a useful trick for
some of you. You can do it like this, using the 'SET variable'
%USERPROFILE%:

OUTPUT SAVE NAME=scratchOutput
       OUTFILE="%USERPROFILE%\Desktop\SPSS
ScratchDir\reliabilities.spo".

I first make the folder using this statement:

HOST COMMAND=['MD "%USERPROFILE%\Desktop\SPSS ScratchDir"'].

Which gives an error if the folder already exists, so you can ignore
that if you run the syntax repeatedly. You could also let SPSS write a
batch file to check this first and only make the folder if need be, of
course.

=====================
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