Date: Mon, 24 Jul 2006 16:34:35 -0500
Reply-To: "Oliver, Richard" <roliver@SPSS.COM>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: "Oliver, Richard" <roliver@SPSS.COM>
Subject: Re: Saving file as part of python program
Content-Type: text/plain; charset="US-ASCII"
Just off the cuff, the 'outfile' within the triple quoted string will be treated as the string 'outfile' not the value of the Python variable outfile. For the triple quoted SPSS command spec try something like:
This is a general Python convention, and there are several examples of this convention in the SPSS-Python plug-in documentation.
From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of Roberts, Michael
Sent: Monday, July 24, 2006 3:29 PM
Subject: Saving file as part of python program
Would someone be able to look at this code and let me know what is wrong? I have tried several approaches, and although the files opened up, the code apparently works only on the last file opened, and then does not save it.
I selected a small sample of 5 spss formatted files in a folder to test the program, which is supposed to open the files one by one, perform an spss function - in this case, select the first ten cases, then save the file with the 'nu' in front of the old file name.
I would appreciate any help you can provide with this, as none of the documentation seems to address how to do this cyclical processing.
set printback on mprint on.
import spss, glob, spssaux
for basefile in savlist:
Thanks in Advance
From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of John Norton
Sent: Monday, July 24, 2006 4:03 PM
Subject: Re: Make bold or in color sign. correlations in output
I wanted to add a caveat (or a "gotcha") to James Parry's reference to the 'Correlations_Table_Correlations_Create' script. This is quite a useful script, but when running correlations from command language and using the WITH statement, this script will still remove the diagonal and the upper half of the matrix, regardless of the WITH statement.
So, for example, if you execute correlations from the dialogs with variables q1 q2 and q3, you'll get a matrix with variables q1 q2 and q3 defining both the rows and the columns. So, in the diagonal, you'll get perfect correlations - as variables tend to do with themselves - and in the upper right corner half of the table you'll get identical correlations as you would with the variable combinations in the lower left half of the matrix. In this case, it makes sense that the diagonals of correlations of variables with themselves, and the redundant upper corner half of the matrix be removed.
But if you use command language with the WITH statement:
/VARIABLES=x1 x2 x3 WITH x4 x5 x6
..you'll get a matrix with variables x1 x2 and x3 defining the rows and variables x4 x5 and x6 defining the columns. The script will still remove the diagonal and the upper right corner half of the matrix, regardless of the fact that in this case, there are no redundancies.
This is more of an annoyance and a speed bump than anything else (especially if/when attempting to demonstrate correlations in class, and after forgetting that you've already demonstrated this script and left it active). Still, it's a "gotcha" to be aware of - it's always a good idea to monitor what you automate. :-)
Loyola University Medical Center
"Absence of evidence
is not evidence of absence"
>>> "Parry, James" <firstname.lastname@example.org> 7/24/2006 2:15 PM >>>
Hi Martin (and list!),
There is a script that comes with SPSS called 'Correlations_Table_Correlations_Create' that 1) omits the top part of the diagonal of the correlation matrix and b) highlights in yellow any significant correlations (to .01, 2-tailed).
The way to activate the autoscript is to go to Edit...Options, choose the Scripts Tab and make sure to select the second script down 'Correlations_Table_Correlations_Create'. After selecting the script, make sure to press OK, and then run correlations.
Also, if you're interested in altering any of the parameters (say significance level to be highlighted, color of highlighting or font, etc.), or if you want to make the script work for Spearman's, here is a link to an earlier, detailed explanation by one of SPSS' Statisticians:
If anyone happens to have a version of this script in another language (Python, VB, etc.) please feel free to submit it to:
http://www.spss.com/devcentral/, our new meeting place for SPSS'ers interested in powerful statistical development.
James E. Parry