Topic
3 replies Latest Post - ‏2013-10-14T14:04:46Z by JonPeck
LazerGuidedStefan
LazerGuidedStefan
2 Posts
ACCEPTED ANSWER

Pinned topic Multiple Response Set inside Custom Table

‏2013-10-14T12:45:52Z |
I'm trying to manipulate Custom Tables output from an external python script. The tables I'm working on always have one (and only one) row variable, and always one or more column variables. Now I want to treat Multiple Response sets among the columnvariables differently from other columnvariables. Is there a way to know, programmitically, if a columnvariable is a single SPSS column or a Multiple Response set? 
 
I'm currently working with the DataCellArray and the ColumnLabelArray, but none of these can reveal the presence of a Multiple Response Set. 
 
I hope I made my problem somewhat clear...
  • JonPeck
    JonPeck
    191 Posts
    ACCEPTED ANSWER

    Re: Multiple Response Set inside Custom Table

    ‏2013-10-14T13:04:13Z  in response to LazerGuidedStefan

    From the point of view of the constructed table, there is nothing special about a multiple response set used in the table, so you won't find information about that via the scripting apis.  If, however, you use OMS XML to retrieve the table, you get variable name information as part of a group element, and mult response set names and only such names start with $.  You can get detailed information about the set definitions using the multiResponseSet api that is part of the Dataset class.

    • LazerGuidedStefan
      LazerGuidedStefan
      2 Posts
      ACCEPTED ANSWER

      Re: Multiple Response Set inside Custom Table

      ‏2013-10-14T13:34:41Z  in response to JonPeck

      I can't find OMS XML in the Python Reference Guide. And the GetXML method only seems to work on ChartItem and ModelItem. Or are You referring to 'plain' syntax? Should I not use CTABLES from syntax when I make my tables?

       

      Sorry for my newbie ignorance... 

      • JonPeck
        JonPeck
        191 Posts
        ACCEPTED ANSWER

        Re: Multiple Response Set inside Custom Table

        ‏2013-10-14T14:04:46Z  in response to LazerGuidedStefan

        OMS is a regular Statistics command.  If you wrap your CTABLES syntax in an OMS command and specify that the destination is the XMLWORKSPACE (format OXML), Statistics creates an XML object with the table results.

        You can use the CreateXmlOutput api in the spssaux module and the spss.EvaluateXPath api to handle this.  You can, of course, just roll your own syntax instead of using CreateXmlOutput.  You can also retrieve the XML with spss.GetXmlUtf16 and use other Python library apis to parse it if you don't want to use XPath.