|
Okay -
well here is a most basic example - that doesnt work - syntax runs - no errors - BUT the only thing merged is the line "results ..." in the caption or footnote (not even the rest "a: ...") any ideas? BEGIN PROGRAM PYTHON. import sys, spss, tables help (spss) help (tables) END PROGRAM. CTABLES /FORMAT EMPTY=BLANK /MRSETS COUNTDUPLICATES=NO /VLABELS VARIABLES=ALL DISPLAY=LABEL /TABLE sex [C] [TOTALS[UCOUNT,'UWt',F6.0,COUNT,'Wgt',F6.0], COUNT,'Wgt N', F5.0,COLPCT.VALIDN,'Wgt %',PCT5.0] BY base[C]+bsex[C]+brace[C]+bregn[C]+bhapy[C]+$ban1[C] /SLABELS POSITION=ROW VISIBLE=YES /CATEGORIES VAR=sex TOTAL=YES POSITION=BEFORE EMPTY=EXCLUDE MISSING=EXCLUDE /COMPARETEST TYPE=PROP ALPHA=0.05 /TITLE CAPTION="Tim Hennigar" 'SPSS TABLES EXAMPLE' 'Primary Banner - June 03 2005 (Weighted)' 'Run: Date-)DATE, Time-)TIME' TITLE= "(1) Respondent's Sex" " " "BASE: ALL RESPONDENTS" . BEGIN PROGRAM PYTHON. tables.mergeLatest(hide=False) END PROGRAM. (1) Respondent's Sex BASE: ALL RESPONDENTS Comparisons of Column Proportions GENDER RACE REGION HAPPINESS LIFE IS... Total Male Female White Black Other North East South East West Very Happy Pretty Happy Not Too Happy Exciting Routine/ Dull Respondent's Sex Total UWt 1517 636 881 1264 204 49 679 415 423 467 872 165 434 546 Wgt 1517 636 881 1264 204 49 679 415 423 467 872 165 434 546 Male Wgt N 636 636 545 71 20 281 177 178 206 374 53 213 212 Wgt % 42% 100% 43% 35% 41% 41% 43% 42% 44% 43% 32% 49% 39% Female Wgt N 881 881 719 133 29 398 238 245 261 498 112 221 334 Wgt % 58% 100% 57% 65% 59% 59% 57% 58% 56% 57% 68% 51% 61% Tim Hennigar SPSS TABLES EXAMPLE Primary Banner - June 03 2005 (Weighted) Run: Date-08/08/2007, Time-9:13:42 AM Results are based on two-sided tests with significance level 0.05. For each significant pair, the key of the category with the smaller column proportion appears under the category with the larger column proportion. Thanks! Tim **************************** Notice: This e-mail and any attachments may contain confidential and privileged information. If you are not the intended recipient, please notify the sender immediately by return e-mail, do not use the information, delete this e-mail and destroy any copies. Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal. Email transmissions cannot be guaranteed to be secure or error free. The sender therefore does not accept any liability for errors or omissions in the contents of this message that arise as a result of email transmissions. |
|
By default, the table merger looks for "Count" as the leaf element in the column to figure out the merge point. Since you have a different label, you have to tell it the merge point. Try adding
label="UWt" to the parameter list tables.mergeLatest(hide=False, label="UWt") If that doesn't work, I'd have to see an actual table (-> [hidden email]) to see what is going on. The general idea of the table merger is that it is doing a join of columns according to the criteria you specify, so if the join criteria don't match, it doesn't do anything. HTH, Jon Peck (intermittently available over the next few weeks while recovering from surgery on my neck) -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Tim Hennigar Sent: Wednesday, August 08, 2007 8:34 AM To: [hidden email] Subject: [SPSSX-L] Ctables/Python merge Okay - well here is a most basic example - that doesnt work - syntax runs - no errors - BUT the only thing merged is the line "results ..." in the caption or footnote (not even the rest "a: ...") any ideas? BEGIN PROGRAM PYTHON. import sys, spss, tables help (spss) help (tables) END PROGRAM. CTABLES /FORMAT EMPTY=BLANK /MRSETS COUNTDUPLICATES=NO /VLABELS VARIABLES=ALL DISPLAY=LABEL /TABLE sex [C] [TOTALS[UCOUNT,'UWt',F6.0,COUNT,'Wgt',F6.0], COUNT,'Wgt N', F5.0,COLPCT.VALIDN,'Wgt %',PCT5.0] BY base[C]+bsex[C]+brace[C]+bregn[C]+bhapy[C]+$ban1[C] /SLABELS POSITION=ROW VISIBLE=YES /CATEGORIES VAR=sex TOTAL=YES POSITION=BEFORE EMPTY=EXCLUDE MISSING=EXCLUDE /COMPARETEST TYPE=PROP ALPHA=0.05 /TITLE CAPTION="Tim Hennigar" 'SPSS TABLES EXAMPLE' 'Primary Banner - June 03 2005 (Weighted)' 'Run: Date-)DATE, Time-)TIME' TITLE= "(1) Respondent's Sex" " " "BASE: ALL RESPONDENTS" . BEGIN PROGRAM PYTHON. tables.mergeLatest(hide=False) END PROGRAM. (1) Respondent's Sex BASE: ALL RESPONDENTS Comparisons of Column Proportions GENDER RACE REGION HAPPINESS LIFE IS... Total Male Female White Black Other North East South East West Very Happy Pretty Happy Not Too Happy Exciting Routine/ Dull Respondent's Sex Total UWt 1517 636 881 1264 204 49 679 415 423 467 872 165 434 546 Wgt 1517 636 881 1264 204 49 679 415 423 467 872 165 434 546 Male Wgt N 636 636 545 71 20 281 177 178 206 374 53 213 212 Wgt % 42% 100% 43% 35% 41% 41% 43% 42% 44% 43% 32% 49% 39% Female Wgt N 881 881 719 133 29 398 238 245 261 498 112 221 334 Wgt % 58% 100% 57% 65% 59% 59% 57% 58% 56% 57% 68% 51% 61% Tim Hennigar SPSS TABLES EXAMPLE Primary Banner - June 03 2005 (Weighted) Run: Date-08/08/2007, Time-9:13:42 AM Results are based on two-sided tests with significance level 0.05. For each significant pair, the key of the category with the smaller column proportion appears under the category with the larger column proportion. Thanks! Tim **************************** Notice: This e-mail and any attachments may contain confidential and privileged information. If you are not the intended recipient, please notify the sender immediately by return e-mail, do not use the information, delete this e-mail and destroy any copies. Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal. Email transmissions cannot be guaranteed to be secure or error free. The sender therefore does not accept any liability for errors or omissions in the contents of this message that arise as a result of email transmissions. |
|
Jon I was also facing similar type of problem. I have several custom tables and column proportions results. I want to merge the column proportion stat testing with the count and % table i.e. the significance should be placed next to the respective number. Is this doable using python? Someone suggested to see spss dcentral however i could not find the relevant code.
Any input is highly appreciated. -----Original Message----- From: SPSSX(r) Discussion on behalf of Peck, Jon Sent: Sat 8/11/2007 10:17 PM To: [hidden email] Cc: Subject: Re: Ctables/Python merge By default, the table merger looks for "Count" as the leaf element in the column to figure out the merge point. Since you have a different label, you have to tell it the merge point. Try adding label="UWt" to the parameter list tables.mergeLatest(hide=False, label="UWt") If that doesn't work, I'd have to see an actual table (-> [hidden email]) to see what is going on. The general idea of the table merger is that it is doing a join of columns according to the criteria you specify, so if the join criteria don't match, it doesn't do anything. HTH, Jon Peck (intermittently available over the next few weeks while recovering from surgery on my neck) -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Tim Hennigar Sent: Wednesday, August 08, 2007 8:34 AM To: [hidden email] Subject: [SPSSX-L] Ctables/Python merge Okay - well here is a most basic example - that doesnt work - syntax runs - no errors - BUT the only thing merged is the line "results ..." in the caption or footnote (not even the rest "a: ...") any ideas? BEGIN PROGRAM PYTHON. import sys, spss, tables help (spss) help (tables) END PROGRAM. CTABLES /FORMAT EMPTY=BLANK /MRSETS COUNTDUPLICATES=NO /VLABELS VARIABLES=ALL DISPLAY=LABEL /TABLE sex [C] [TOTALS[UCOUNT,'UWt',F6.0,COUNT,'Wgt',F6.0], COUNT,'Wgt N', F5.0,COLPCT.VALIDN,'Wgt %',PCT5.0] BY base[C]+bsex[C]+brace[C]+bregn[C]+bhapy[C]+$ban1[C] /SLABELS POSITION=ROW VISIBLE=YES /CATEGORIES VAR=sex TOTAL=YES POSITION=BEFORE EMPTY=EXCLUDE MISSING=EXCLUDE /COMPARETEST TYPE=PROP ALPHA=0.05 /TITLE CAPTION="Tim Hennigar" 'SPSS TABLES EXAMPLE' 'Primary Banner - June 03 2005 (Weighted)' 'Run: Date-)DATE, Time-)TIME' TITLE= "(1) Respondent's Sex" " " "BASE: ALL RESPONDENTS" . BEGIN PROGRAM PYTHON. tables.mergeLatest(hide=False) END PROGRAM. (1) Respondent's Sex BASE: ALL RESPONDENTS Comparisons of Column Proportions GENDER RACE REGION HAPPINESS LIFE IS... Total Male Female White Black Other North East South East West Very Happy Pretty Happy Not Too Happy Exciting Routine/ Dull Respondent's Sex Total UWt 1517 636 881 1264 204 49 679 415 423 467 872 165 434 546 Wgt 1517 636 881 1264 204 49 679 415 423 467 872 165 434 546 Male Wgt N 636 636 545 71 20 281 177 178 206 374 53 213 212 Wgt % 42% 100% 43% 35% 41% 41% 43% 42% 44% 43% 32% 49% 39% Female Wgt N 881 881 719 133 29 398 238 245 261 498 112 221 334 Wgt % 58% 100% 57% 65% 59% 59% 57% 58% 56% 57% 68% 51% 61% Tim Hennigar SPSS TABLES EXAMPLE Primary Banner - June 03 2005 (Weighted) Run: Date-08/08/2007, Time-9:13:42 AM Results are based on two-sided tests with significance level 0.05. For each significant pair, the key of the category with the smaller column proportion appears under the category with the larger column proportion. Thanks! Tim **************************** Notice: This e-mail and any attachments may contain confidential and privileged information. If you are not the intended recipient, please notify the sender immediately by return e-mail, do not use the information, delete this e-mail and destroy any copies. Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal. Email transmissions cannot be guaranteed to be secure or error free. The sender therefore does not accept any liability for errors or omissions in the contents of this message that arise as a result of email transmissions. |
|
You should be able to get pretty close with the Python tables module. You will find it on the downloads link under Tables module. The modules are listed alphabetically. It is easier to find things if you click "single page view" in the downloads header. There is also tables examples download that may help, and there are examples in the module itself.
Note that this module depends on a number of other modules that you will need to download from Developer Central and elsewhere, and, of course, Python 2.4 and the plug-in. HTH, Jon Peck -----Original Message----- From: Manmit Shrimali [mailto:[hidden email]] Sent: Sunday, August 12, 2007 1:15 AM To: Peck, Jon; [hidden email] Subject: RE: Re: Ctables/Python merge Jon I was also facing similar type of problem. I have several custom tables and column proportions results. I want to merge the column proportion stat testing with the count and % table i.e. the significance should be placed next to the respective number. Is this doable using python? Someone suggested to see spss dcentral however i could not find the relevant code. Any input is highly appreciated. -----Original Message----- From: SPSSX(r) Discussion on behalf of Peck, Jon Sent: Sat 8/11/2007 10:17 PM To: [hidden email] Cc: Subject: Re: Ctables/Python merge By default, the table merger looks for "Count" as the leaf element in the column to figure out the merge point. Since you have a different label, you have to tell it the merge point. Try adding label="UWt" to the parameter list tables.mergeLatest(hide=False, label="UWt") If that doesn't work, I'd have to see an actual table (-> [hidden email]) to see what is going on. The general idea of the table merger is that it is doing a join of columns according to the criteria you specify, so if the join criteria don't match, it doesn't do anything. HTH, Jon Peck (intermittently available over the next few weeks while recovering from surgery on my neck) -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Tim Hennigar Sent: Wednesday, August 08, 2007 8:34 AM To: [hidden email] Subject: [SPSSX-L] Ctables/Python merge Okay - well here is a most basic example - that doesnt work - syntax runs - no errors - BUT the only thing merged is the line "results ..." in the caption or footnote (not even the rest "a: ...") any ideas? BEGIN PROGRAM PYTHON. import sys, spss, tables help (spss) help (tables) END PROGRAM. CTABLES /FORMAT EMPTY=BLANK /MRSETS COUNTDUPLICATES=NO /VLABELS VARIABLES=ALL DISPLAY=LABEL /TABLE sex [C] [TOTALS[UCOUNT,'UWt',F6.0,COUNT,'Wgt',F6.0], COUNT,'Wgt N', F5.0,COLPCT.VALIDN,'Wgt %',PCT5.0] BY base[C]+bsex[C]+brace[C]+bregn[C]+bhapy[C]+$ban1[C] /SLABELS POSITION=ROW VISIBLE=YES /CATEGORIES VAR=sex TOTAL=YES POSITION=BEFORE EMPTY=EXCLUDE MISSING=EXCLUDE /COMPARETEST TYPE=PROP ALPHA=0.05 /TITLE CAPTION="Tim Hennigar" 'SPSS TABLES EXAMPLE' 'Primary Banner - June 03 2005 (Weighted)' 'Run: Date-)DATE, Time-)TIME' TITLE= "(1) Respondent's Sex" " " "BASE: ALL RESPONDENTS" . BEGIN PROGRAM PYTHON. tables.mergeLatest(hide=False) END PROGRAM. (1) Respondent's Sex BASE: ALL RESPONDENTS Comparisons of Column Proportions GENDER RACE REGION HAPPINESS LIFE IS... Total Male Female White Black Other North East South East West Very Happy Pretty Happy Not Too Happy Exciting Routine/ Dull Respondent's Sex Total UWt 1517 636 881 1264 204 49 679 415 423 467 872 165 434 546 Wgt 1517 636 881 1264 204 49 679 415 423 467 872 165 434 546 Male Wgt N 636 636 545 71 20 281 177 178 206 374 53 213 212 Wgt % 42% 100% 43% 35% 41% 41% 43% 42% 44% 43% 32% 49% 39% Female Wgt N 881 881 719 133 29 398 238 245 261 498 112 221 334 Wgt % 58% 100% 57% 65% 59% 59% 57% 58% 56% 57% 68% 51% 61% Tim Hennigar SPSS TABLES EXAMPLE Primary Banner - June 03 2005 (Weighted) Run: Date-08/08/2007, Time-9:13:42 AM Results are based on two-sided tests with significance level 0.05. For each significant pair, the key of the category with the smaller column proportion appears under the category with the larger column proportion. Thanks! Tim **************************** Notice: This e-mail and any attachments may contain confidential and privileged information. If you are not the intended recipient, please notify the sender immediately by return e-mail, do not use the information, delete this e-mail and destroy any copies. Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal. Email transmissions cannot be guaranteed to be secure or error free. The sender therefore does not accept any liability for errors or omissions in the contents of this message that arise as a result of email transmissions. |
|
In reply to this post by Tim AT Home
Thanks Jon. I downloaded python 2.4 and then plug in however I am still
not able to use python feature. When I get following error: Command: BEGIN PROGRAM. import spss, spssaux import os.path, sys spssaux.GetProcessInstallDir("SPSSDIR") end program. >Error # 6887. Command name: BEGIN PROGRAM >External program failed during initialization. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Peck, Jon Sent: Sunday, August 12, 2007 9:19 PM To: [hidden email] Subject: Re: Ctables/Python merge You should be able to get pretty close with the Python tables module. You will find it on the downloads link under Tables module. The modules are listed alphabetically. It is easier to find things if you click "single page view" in the downloads header. There is also tables examples download that may help, and there are examples in the module itself. Note that this module depends on a number of other modules that you will need to download from Developer Central and elsewhere, and, of course, Python 2.4 and the plug-in. HTH, Jon Peck -----Original Message----- From: Manmit Shrimali [mailto:[hidden email]] Sent: Sunday, August 12, 2007 1:15 AM To: Peck, Jon; [hidden email] Subject: RE: Re: Ctables/Python merge Jon I was also facing similar type of problem. I have several custom tables and column proportions results. I want to merge the column proportion stat testing with the count and % table i.e. the significance should be placed next to the respective number. Is this doable using python? Someone suggested to see spss dcentral however i could not find the relevant code. Any input is highly appreciated. -----Original Message----- From: SPSSX(r) Discussion on behalf of Peck, Jon Sent: Sat 8/11/2007 10:17 PM To: [hidden email] Cc: Subject: Re: Ctables/Python merge By default, the table merger looks for "Count" as the leaf element in the column to figure out the merge point. Since you have a different label, you have to tell it the merge point. Try adding label="UWt" to the parameter list tables.mergeLatest(hide=False, label="UWt") If that doesn't work, I'd have to see an actual table (-> [hidden email]) to see what is going on. The general idea of the table merger is that it is doing a join of columns according to the criteria you specify, so if the join criteria don't match, it doesn't do anything. HTH, Jon Peck (intermittently available over the next few weeks while recovering from surgery on my neck) -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Tim Hennigar Sent: Wednesday, August 08, 2007 8:34 AM To: [hidden email] Subject: [SPSSX-L] Ctables/Python merge Okay - well here is a most basic example - that doesnt work - syntax runs - no errors - BUT the only thing merged is the line "results ..." in the caption or footnote (not even the rest "a: ...") any ideas? BEGIN PROGRAM PYTHON. import sys, spss, tables help (spss) help (tables) END PROGRAM. CTABLES /FORMAT EMPTY=BLANK /MRSETS COUNTDUPLICATES=NO /VLABELS VARIABLES=ALL DISPLAY=LABEL /TABLE sex [C] [TOTALS[UCOUNT,'UWt',F6.0,COUNT,'Wgt',F6.0], COUNT,'Wgt N', F5.0,COLPCT.VALIDN,'Wgt %',PCT5.0] BY base[C]+bsex[C]+brace[C]+bregn[C]+bhapy[C]+$ban1[C] /SLABELS POSITION=ROW VISIBLE=YES /CATEGORIES VAR=sex TOTAL=YES POSITION=BEFORE EMPTY=EXCLUDE MISSING=EXCLUDE /COMPARETEST TYPE=PROP ALPHA=0.05 /TITLE CAPTION="Tim Hennigar" 'SPSS TABLES EXAMPLE' 'Primary Banner - June 03 2005 (Weighted)' 'Run: Date-)DATE, Time-)TIME' TITLE= "(1) Respondent's Sex" " " "BASE: ALL RESPONDENTS" . BEGIN PROGRAM PYTHON. tables.mergeLatest(hide=False) END PROGRAM. (1) Respondent's Sex BASE: ALL RESPONDENTS Comparisons of Column Proportions GENDER RACE REGION HAPPINESS LIFE IS... Total Male Female White Black Other North East South East West Very Happy Pretty Happy Not Too Happy Exciting Routine/ Dull Respondent's Sex Total UWt 1517 636 881 1264 204 49 679 415 423 467 872 165 434 546 Wgt 1517 636 881 1264 204 49 679 415 423 467 872 165 434 546 Male Wgt N 636 636 545 71 20 281 177 178 206 374 53 213 212 Wgt % 42% 100% 43% 35% 41% 41% 43% 42% 44% 43% 32% 49% 39% Female Wgt N 881 881 719 133 29 398 238 245 261 498 112 221 334 Wgt % 58% 100% 57% 65% 59% 59% 57% 58% 56% 57% 68% 51% 61% Tim Hennigar SPSS TABLES EXAMPLE Primary Banner - June 03 2005 (Weighted) Run: Date-08/08/2007, Time-9:13:42 AM Results are based on two-sided tests with significance level 0.05. For each significant pair, the key of the category with the smaller column proportion appears under the category with the larger column proportion. Thanks! Tim **************************** Notice: This e-mail and any attachments may contain confidential and privileged information. If you are not the intended recipient, please notify the sender immediately by return e-mail, do not use the information, delete this e-mail and destroy any copies. Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal. Email transmissions cannot be guaranteed to be secure or error free. The sender therefore does not accept any liability for errors or omissions in the contents of this message that arise as a result of transmissions. |
| Free forum by Nabble | Edit this page |
