|
And in for a penny in for a pound
since after - I dunno- 12+ years - and seemingly, SPSS unwillingless to fix even the most basic problems (shortcomings) of its tables program (to make it usefull for market research purposes) Netting, Sorting, etc, has anyone written Python script to sort tables leaving dk's etc at the botttom of the table - or more interestingly - to sort NETS (and their contents) while keeping them together? Thanks! Tim |
|
The function below is in the spssaux2.py module downloadable from SPSS Developer Central. Here is a usage example
gencatlist.gencategorylist('store', [5, 21], 'storelist') spss.Submit("""ctables /table store+instore /categories variable=store [!storelist missing]""") This constructs a macro named storelist that lists the categories of the variable store in descending order of unweighted count excluding missing values but moving the values 5 and 21 for store to just before the first zero count or the end. Then it runs ctables with that category order followed by any missing values. Here is the docstring for this function. def genCategoryList(varnames, specialvalues=None, macroname=None, missing='EXCLUDE', order='D', weightvar=None): """Generate and return sorted list(s) of values with possible insertion of extra values. Optionally create SPSS macros. varnames is a sequence of variable names to process. It can also be a blank-separated string of variable names. specialvalues is a sequence of values that should be inserted before the first zero count or at the end if no zeros or None. If a special value already occurs in a varname, it will be moved. Note that for string variables, special values need to have the same width as the variable, including leading and trailing blanks. macroname is a list of macronames of the same length as varnames to generate or None. missing is 'INCLUDE' or 'EXCLUDE' to determine whether user missing values are included or excluded. order is 'A' or 'D' to specify the sort direction. weightvar can be specified as a variable name to be used as a weight in determing the counts to sort by. It must not occur in varnames. This function is mainly useful as a helper function for Ctables in building CATEGORIES subcommands. It may be useful to combine it with OTHERNM and/or MISSING in the category list. """ Regards, Jon Peck -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Tim Hennigar Sent: Friday, July 13, 2007 7:50 AM To: [hidden email] Subject: [SPSSX-L] Python Ctables (One more) And in for a penny in for a pound since after - I dunno- 12+ years - and seemingly, SPSS unwillingless to fix even the most basic problems (shortcomings) of its tables program (to make it usefull for market research purposes) Netting, Sorting, etc, has anyone written Python script to sort tables leaving dk's etc at the botttom of the table - or more interestingly - to sort NETS (and their contents) while keeping them together? Thanks! Tim |
|
In reply to this post by Tim AT Home
---------- Forwarded message ----------
From: Hal 9000 <[hidden email]> Date: Jul 15, 2007 12:16 AM Subject: Re: Python Ctables (One more) To: [hidden email] I agree completely. It's great that 16 has neural networks (for a pretty penny), but for the other 99% of us who do more mundane tasks, we want tables that work, are reliable and modifiable beyond elementary levels! -Gary On 7/13/07, Tim Hennigar <[hidden email]> wrote: > > And in for a penny in for a pound > > since after - I dunno- 12+ years - and seemingly, SPSS unwillingless to > fix > even the most basic > problems (shortcomings) of its tables program (to make it usefull for > market > research purposes) > > Netting, > Sorting, etc, > > has anyone written Python script to sort tables leaving dk's etc at the > botttom of the table - or more > interestingly - to sort NETS (and their contents) while keeping them > together? > > > Thanks! > > Tim > |
|
In reply to this post by Tim AT Home
What is 'netting' with regard to tables?
Tim Hennigar wrote: > And in for a penny in for a pound > > since after - I dunno- 12+ years - and seemingly, SPSS unwillingless to fix > even the most basic > problems (shortcomings) of its tables program (to make it usefull for market > research purposes) > > Netting, > Sorting, etc, > > has anyone written Python script to sort tables leaving dk's etc at the > botttom of the table - or more > interestingly - to sort NETS (and their contents) while keeping them > together? > > > Thanks! > > Tim > > |
|
In reply to this post by Tim AT Home
Hello,
1. Consider you have 9 point scale question 1- strongly disagree to 9 - strongly agree. In this the Top 3 Box (7,8,9) percentage and it's counts are called as Netting. 2. Consider the following Organization type example. From this if you want to sum Accounting and Banking under one common name then it is called as Netting. Accounting/tax Agriculture, forestry, fishing Banking Business services Construction Finance/insurance/real estate Governmentâlocal, regional, provincial Governmentânational, federal Healthcare Hospitality 3. Which are all the Operating System you worked on? Select all that apply. Here if you want add all Windows XP OS, then it is called as Netting. Windows 98 (any) Windows NT Workstation version 4 Windows 2000 Windows Millennium Edition or Windows ME Windows XP Home Windows XP Professional Windows XP Tablet PC Edition Windows XP Starter Edition Windows XP (donât know version) Windows Vista Linux Macintosh Thanks, Lawrence |
|
So, taking the OS example, I could in CTables produce a table with only
WinXP systems by representing the operating system strings as numerical values (using Autorecode) and using the Categories subcommand to select the categories that are XP systems. (In my file I had one variable with the XP system code and one with a count variable). Would this be an example of netting? * Custom Tables. CTABLES /VLABELS VARIABLES=count OSCode DISPLAY=BOTH /TABLE OSCode BY count [SUM] /CATEGORIES VARIABLES=ocCode [12, 11, 10, 9, 8] EMPTY=EXCLUDE TOTAL=YES POSITION=AFTER. Custom Tables [DataSet0] ------------------------------ | | |count| | | |-----| | | |Mean | |----------------------------| |OSCode|Windows XP |47 | | |Tablet PC | | | |Edition | | | |---------------------| | |Windows XP |87 | | |Starter Edition| | | |---------------------| | |Windows XP |75 | | |Professional | | | |---------------------| | |Windows XP Home|43 | | |---------------------| | |Windows XP |56 | | |(dont know | | | |version) | | | |---------------------| | |Total | 308 | ------------------------------ Lawrence Joseph wrote: > Hello, > > > 1. Consider you have 9 point scale question 1- strongly disagree to 9 - > strongly agree. In this the Top 3 Box (7,8,9) percentage and it's counts > are called as Netting. > > 2. Consider the following Organization type example. From this if you want > to sum Accounting and Banking under one common name then it is called as > Netting. > > Accounting/tax > Agriculture, forestry, fishing > Banking > Business services > Construction > Finance/insurance/real estate > Government—local, regional, provincial > Government—national, federal > Healthcare > Hospitality > > 3. Which are all the Operating System you worked on? Select all that apply. > > Here if you want add all Windows XP OS, then it is called as Netting. > > Windows 98 (any) > Windows NT Workstation version 4 > Windows 2000 > Windows Millennium Edition or Windows ME > Windows XP Home > Windows XP Professional > Windows XP Tablet PC Edition > Windows XP Starter Edition > Windows XP (don’t know version) > Windows Vista > Linux > Macintosh > > > Thanks, > > Lawrence > > -- Daniel Robertson Senior Research and Planning Associate Institutional Research and Planning Cornell University, Ithaca NY 14853-2801 607.255.9642 / irp.cornell.edu |
|
Generally nets are subtotals of discontiguous categories. If you know the categories in advance, this is easy to do with Ctables by specifying the category list explicitly and using subtotals. You can even hide the subtotaled categories,
e.g., [12 10 5 subtotal othernm] (nonhiding) or [12 10 5 hsubtotal othernm] (hiding) You can't have a subtotal of discontiguous categories, but you can put a variable into a table twice by cloning it and get selected categories totaled. For example, CTABLES /TABLE happy + happy2 /CATEGORIES VARIABLES=happy empty=include total=yes /CATEGORIES VARIABLES=happy2 [1, 3, SUBTOTAL]. If you want to pick the categories dynamically based on count, say, the genCategoryList function I wrote about earlier or something similar can help. Regards, Jon Peck -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Daniel Robertson Sent: Thursday, July 19, 2007 8:09 AM To: [hidden email] Subject: Re: [SPSSX-L] Python Ctables (One more) So, taking the OS example, I could in CTables produce a table with only WinXP systems by representing the operating system strings as numerical values (using Autorecode) and using the Categories subcommand to select the categories that are XP systems. (In my file I had one variable with the XP system code and one with a count variable). Would this be an example of netting? * Custom Tables. CTABLES /VLABELS VARIABLES=count OSCode DISPLAY=BOTH /TABLE OSCode BY count [SUM] /CATEGORIES VARIABLES=ocCode [12, 11, 10, 9, 8] EMPTY=EXCLUDE TOTAL=YES POSITION=AFTER. Custom Tables [DataSet0] ------------------------------ | | |count| | | |-----| | | |Mean | |----------------------------| |OSCode|Windows XP |47 | | |Tablet PC | | | |Edition | | | |---------------------| | |Windows XP |87 | | |Starter Edition| | | |---------------------| | |Windows XP |75 | | |Professional | | | |---------------------| | |Windows XP Home|43 | | |---------------------| | |Windows XP |56 | | |(dont know | | | |version) | | | |---------------------| | |Total | 308 | ------------------------------ Lawrence Joseph wrote: > Hello, > > > 1. Consider you have 9 point scale question 1- strongly disagree to 9 - > strongly agree. In this the Top 3 Box (7,8,9) percentage and it's counts > are called as Netting. > > 2. Consider the following Organization type example. From this if you want > to sum Accounting and Banking under one common name then it is called as > Netting. > > Accounting/tax > Agriculture, forestry, fishing > Banking > Business services > Construction > Finance/insurance/real estate > Government—local, regional, provincial > Government—national, federal > Healthcare > Hospitality > > 3. Which are all the Operating System you worked on? Select all that apply. > > Here if you want add all Windows XP OS, then it is called as Netting. > > Windows 98 (any) > Windows NT Workstation version 4 > Windows 2000 > Windows Millennium Edition or Windows ME > Windows XP Home > Windows XP Professional > Windows XP Tablet PC Edition > Windows XP Starter Edition > Windows XP (don’t know version) > Windows Vista > Linux > Macintosh > > > Thanks, > > Lawrence > > -- Daniel Robertson Senior Research and Planning Associate Institutional Research and Planning Cornell University, Ithaca NY 14853-2801 607.255.9642 / irp.cornell.edu |
| Free forum by Nabble | Edit this page |
