I want to use Pivot Table to sort the rows in correlation output. How can I get correlation output with just the correlation, without sig or N? Nothing in the FM on this. Either: CORR var235 to var250. or: CORR var250 with var235 to var249. John F Hall MA (Cantab) Dip Ed (Dunelm) IBM-SPSS Academic Author 9900074 Email: [hidden email] Website: Journeys in Survey Research Course: Survey Analysis Workshop (SPSS) |
Believe it or not. FACTOR /VARIABLES X Y Z W /PRINT CORRELATION /ROTATION NOROTATE . From: SPSSX(r) Discussion <[hidden email]> On Behalf Of Joihn F Hall I want to use Pivot Table to sort the rows in correlation output. How can I get correlation output with just the correlation, without sig or N? Nothing in the FM on this. Either: CORR var235 to var250. or: CORR var250 with var235 to var249. John F Hall MA (Cantab) Dip Ed (Dunelm) IBM-SPSS Academic Author 9900074 Email: [hidden email] Website: Journeys in Survey Research Course: Survey Analysis Workshop (SPSS) ===================== 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 |
Thanks Jeff Simple when you know how. BUT for some reason Sort Rows is greyed out in Pivot Tables so I still have to copy the output to Excel and do it manually (where filter/sort doesn't work either, and neither does Ctrl+H to delete common text in all var labels: it only worked on the first highlit cell) to get: Correlation of Satisfaction with: Sub-domain District
I didn't choose the colour scheme either! Constant problems since Windows 10 Pro installed: Office 365 keeps playing up as well. Both think they know better than me what I want. John John F Hall MA (Cantab) Dip Ed (Dunelm) IBM-SPSS Academic Author 9900074 Email: [hidden email] Website: Journeys in Survey Research Course: Survey Analysis Workshop (SPSS) From: SPSSX(r) Discussion <[hidden email]> On Behalf Of Jeff A Believe it or not. FACTOR /VARIABLES X Y Z W /PRINT CORRELATION /ROTATION NOROTATE . From: SPSSX(r) Discussion <[hidden email]> On Behalf Of Joihn F Hall I want to use Pivot Table to sort the rows in correlation output. How can I get correlation output with just the correlation, without sig or N? Nothing in the FM on this. Either: CORR var235 to var250. or: CORR var250 with var235 to var249. John F Hall MA (Cantab) Dip Ed (Dunelm) IBM-SPSS Academic Author 9900074 Email: [hidden email] Website: Journeys in Survey Research Course: Survey Analysis Workshop (SPSS) ===================== 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 |
Administrator
|
John, your example below suggests that you want to use the keyword WITH in
your CORRELATIONS command to generate a table of correlations with a single column, and that you want to then sort the rows of that table by the magnitude of the correlations. Is that right? Does this example give the result you are looking for? (Change the path on the GET FILE command to indicate where the sample datasets are stored on your computer.) NEW FILE. DATASET CLOSE ALL. * Change path on next line as needed. GET FILE='C:\SPSSdata\survey_sample.sav'. DATASET NAME raw. * OMS. DATASET DECLARE corrmat. OMS /SELECT TABLES /TAG = "corr" /IF COMMANDS=['Correlations'] SUBTYPES=['Correlations'] /DESTINATION FORMAT=SAV NUMBERED=TableNumber_ OUTFILE='corrmat' VIEWER=YES. * Variables before WITH are row variables; variables after WITH are column variables. CORRELATIONS educ paeduc maeduc speduc WITH age. OMSEND TAG = "corr". DATASET ACTIVATE corrmat. * Keep only the rows with the correlations. SELECT IF Var2 EQ "Pearson Correlation". EXECUTE. RENAME VARIABLES (Ageofrespondent = Age). COMPUTE absr = ABS(Age). EXECUTE. SORT CASES by absr(D). VARIABLE LABELS Var1 "Variable". SUMMARIZE /TABLES=Var1 Age /FORMAT=LIST NOCASENUM /TITLE='Correlations with Age' /MISSING=VARIABLE /CELLS=NONE. John F Hall wrote > Thanks Jeff > Simple when you know how. > BUT for some reason Sort Rows is greyed out in Pivot Tables so I still > have > to copy the output to Excel and do it manually (where filter/sort doesn't > work either, and neither does Ctrl+H to delete common text in all var > labels: it only worked on the first highlit cell) to get: > > Correlation of Satisfaction with: > Sub-domain District > > > TRANSPORT > 0.678 > > SHOPS > 0.670 > > NOISE > 0.561 > > ENTERTAINMT > 0.544 > > CRIME > 0.517 > > SCHOOLS > 0.495 > > PARKS > 0.398 > > ROADS,PATHS > 0.361 > > TRAFFIC > 0.349 > > APPEARANCE > 0.327 > > NIGHT SAFE > 0.326 > > NEAR FAMILY > 0.311 > > NEAR FRENDS > 0.287 > > POLLUTION > 0.285 > > PEOPLE > 0.226 > > I didn't choose the colour scheme either! Constant problems since Windows > 10 Pro installed: Office 365 keeps playing up as well. Both think they > know > better than me what I want. > > John > > John F Hall MA (Cantab) Dip Ed (Dunelm) > IBM-SPSS Academic Author 9900074 > > Email: <mailto: > johnfhall@ > > > johnfhall@ > > Website: <https://surveyresearch.weebly.com/> Journeys in Survey > Research > Course: > <https://surveyresearch.weebly.com/1-survey-analysis-workshop-spss.html> > Survey Analysis Workshop (SPSS) > > > > From: SPSSX(r) Discussion < > SPSSX-L@.UGA > > On Behalf Of Jeff A > Sent: 21 July 2020 12:15 > To: > SPSSX-L@.UGA > Subject: Re: How get simple correlation matrix (r only) > > Believe it or not. > > > FACTOR > /VARIABLES X Y Z W > /PRINT CORRELATION > /ROTATION NOROTATE . > > > From: SPSSX(r) Discussion < > SPSSX-L@.UGA > <mailto: > SPSSX-L@.UGA > > > On Behalf Of Joihn F Hall > Sent: Tuesday, July 21, 2020 7:39 PM > To: > SPSSX-L@.UGA > <mailto: > SPSSX-L@.UGA > > > Subject: How get simple correlation matrix (r only) > > I want to use Pivot Table to sort the rows in correlation output. > How can I get correlation output with just the correlation, without sig or > N? > Nothing in the FM on this. > > Either: > CORR var235 to var250. > or: > CORR var250 with var235 to var249. > > John F Hall MA (Cantab) Dip Ed (Dunelm) > IBM-SPSS Academic Author 9900074 > > Email: > johnfhall@ > <mailto: > johnfhall@ > > > Website: Journeys in Survey Research > <https://surveyresearch.weebly.com/> > Course: Survey Analysis Workshop (SPSS) > <https://surveyresearch.weebly.com/1-survey-analysis-workshop-spss.html> > > ===================== To manage your subscription to SPSSX-L, send a > message > to > LISTSERV@.UGA > <mailto: > LISTSERV@.UGA > > (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 > > > > <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campai > gn=sig-email&utm_content=emailclient> > Virus-free. > <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campai > gn=sig-email&utm_content=emailclient> www.avast.com > ===================== To manage your subscription to SPSSX-L, send a > message > to > LISTSERV@.UGA > <mailto: > LISTSERV@.UGA > > (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 > LISTSERV@.UGA > (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 ----- -- Bruce Weaver [hidden email] http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." NOTE: My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. -- Sent from: http://spssx-discussion.1045642.n5.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
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
If Bruce is on the right track in suggesting WITH, you can do the sorting with a double application of SPSSINC MODIFY TABLES like this. The first MODIFY TABLES call moves the correlation statistics to the columns of the table. Then the second one does the sort. This ignores the magnitude issue. I assumed descending order, but you could change d to a below for ascending. correlations salary salbegin prevexp with bdate. SPSSINC MODIFY TABLES subtype="'Correlations'" SELECT=0 PROCESS = PRECEDING /STYLES APPLYTO=DATACELLS CUSTOMFUNCTION="customstylefunctions.sortTable(direction='d')". SPSSINC MODIFY TABLES subtype="'Correlations'" SELECT="<<ALL>>" PROCESS = PRECEDING /STYLES APPLYTO=DATACELLS CUSTOMFUNCTION="customstylefunctions.moveRowsToColumns(fromdim=0, todim=0)". On Tue, Jul 21, 2020 at 7:49 AM Bruce Weaver <[hidden email]> wrote: John, your example below suggests that you want to use the keyword WITH in |
Jon I substituted my variables for yours. correlations var235 to var249 with var250. SPSSINC MODIFY TABLES subtype="'Correlations'" SELECT=0 PROCESS = PRECEDING /STYLES APPLYTO=DATACELLS CUSTOMFUNCTION="customstylefunctions.sortTable(direction='d')". SPSSINC MODIFY TABLES subtype="'Correlations'" SELECT="<<ALL>>" PROCESS = PRECEDING /STYLES APPLYTO=DATACELLS CUSTOMFUNCTION="customstylefunctions.moveRowsToColumns(fromdim=0, todim=0)". I get this error (line 3): SPSSINC MODIFY TABLES subtype="'Correlations'" Error # 1. Command name: SPSSINC The first word in the line is not recognized as an SPSS Statistics command. Execution of this command stops. From: SPSSX(r) Discussion <[hidden email]> On Behalf Of Jon Peck If Bruce is on the right track in suggesting WITH, you can do the sorting with a double application of SPSSINC MODIFY TABLES like this. The first MODIFY TABLES call moves the correlation statistics to the columns of the table. Then the second one does the sort. This ignores the magnitude issue. I assumed descending order, but you could change d to a below for ascending. correlations salary salbegin prevexp with bdate. On Tue, Jul 21, 2020 at 7:49 AM Bruce Weaver <[hidden email]> wrote:
-- Jon K Peck ===================== 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 |
That means that you don’t have the SPSSINC MODIFY TABLES extension command installed. Get it using Extensions > Extension Hub. On Tue, Jul 21, 2020 at 11:13 AM Joihn F Hall <[hidden email]> wrote:
|
Administrator
|
In reply to this post by Jon Peck
I suspected Jon would suggest an extension command. ;-)
Jon, when I add your two SPSSINC MODIFY TABLES commands, I do indeed end up with a table of correlations that has separate columns for r, p, and N. But that table has not been sorted according to the absolute value of r, which is what John wants to do, I think. John, please clarify. Here's the complete example: NEW FILE. DATASET CLOSE ALL. * Change path on next line as needed. GET FILE='C:\SPSSdata\survey_sample.sav'. DATASET NAME raw. CORRELATIONS educ paeduc maeduc speduc WITH age. SPSSINC MODIFY TABLES subtype="'Correlations'" SELECT=0 PROCESS = PRECEDING /STYLES APPLYTO=DATACELLS CUSTOMFUNCTION="customstylefunctions.sortTable(direction='d')". SPSSINC MODIFY TABLES subtype="'Correlations'" SELECT="<<ALL>>" PROCESS = PRECEDING /STYLES APPLYTO=DATACELLS CUSTOMFUNCTION="customstylefunctions.moveRowsToColumns(fromdim=0, todim=0)". And here's the output, copied as text (pardon the poor alignment): Correlations Age of respondent Pearson Correlation Sig. (2-tailed) N Highest year of school completed -.175 .000 2816 Highest year school completed, father -.350 .000 2040 Highest year school completed, mother -.345 .000 2395 Highest year school completed, spouse -.161 .000 1310 Meanwhile, here's a variation on the method I posted earlier. Rather than using OMS, it uses MATRIX=OUT() on the CORRELATIONS command. But note that MATRIX=OUT() only works with square correlation matrices, so I had to remove the WITH. NEW FILE. DATASET CLOSE ALL. * Change path on next line as needed. GET FILE='C:\SPSSdata\survey_sample.sav'. DATASET NAME raw. DATASET DECLARE corrmat. CORRELATIONS educ paeduc maeduc speduc age /MATRIX = OUT("corrmat"). DATASET ACTIVATE corrmat. SELECT IF ROWTYPE_ EQ "CORR" AND VARNAME_ NE "age". COMPUTE absr = ABS(Age). SORT CASES by absr(D). VARIABLE LABELS VARNAME_ "Variable". FORMATS age (F8.3). SUMMARIZE /TABLES=VARNAME_ Age /FORMAT=LIST NOCASENUM /TITLE='Correlations with Age' /MISSING=VARIABLE /CELLS=NONE. Output copied as text: Correlations with Age Variable Age of respondent 1 paeduc -.350 2 maeduc -.345 3 educ -.175 4 speduc -.161 Jon Peck wrote > If Bruce is on the right track in suggesting WITH, you can do the sorting > with a double application of SPSSINC MODIFY TABLES like this. The first > MODIFY TABLES call moves the correlation statistics to the columns of the > table. Then the second one does the sort. This ignores the magnitude > issue. I assumed descending order, but you could change d to a below for > ascending. > > correlations salary salbegin prevexp with bdate. > > SPSSINC MODIFY TABLES subtype="'Correlations'" > SELECT=0 PROCESS = PRECEDING > /STYLES APPLYTO=DATACELLS > CUSTOMFUNCTION="customstylefunctions.sortTable(direction='d')". > > SPSSINC MODIFY TABLES subtype="'Correlations'" > SELECT="< > <ALL> >>" PROCESS = PRECEDING > /STYLES APPLYTO=DATACELLS > CUSTOMFUNCTION="customstylefunctions.moveRowsToColumns(fromdim=0, > todim=0)". ----- -- Bruce Weaver [hidden email] http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." NOTE: My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. -- Sent from: http://spssx-discussion.1045642.n5.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
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
Sorry, I posted the MODIFY TABLES commands in the wrong order. I ran them bottom up. I added a parameter to the sortTable custom function, so the code now looks like this if the sort should be by absolute value. correlations salary salbegin prevexp with bdate. SPSSINC MODIFY TABLES subtype="'Correlations'" SELECT="<<ALL>>" PROCESS = PRECEDING /STYLES APPLYTO=DATACELLS CUSTOMFUNCTION="customstylefunctions.moveRowsToColumns(fromdim=0, todim=0)". SPSSINC MODIFY TABLES subtype="'Correlations'" SELECT=0 PROCESS = PRECEDING /STYLES APPLYTO=DATACELLS CUSTOMFUNCTION="customstylefunctions.sortTable(direction='d', sortabs=True)". I can supply the updated customstylefunctions.py if anyone wants it. On Tue, Jul 21, 2020 at 11:52 AM Bruce Weaver <[hidden email]> wrote: I suspected Jon would suggest an extension command. ;-) |
Free forum by Nabble | Edit this page |