• 1 reply
  • Latest Post - ‏2013-09-05T19:07:22Z by JonPeck
1 Post

Pinned topic How to write Xpath syntax for pivot table ?

‏2013-09-05T18:43:12Z | cross pivot spss table tabulation

Hello all,

   I have a question regarding writting  Xpath  for Cross Tabulation's pivot table that I would like to get your expertise. I have a pivot  table of Tumor * Dose * Sex  Cross Tabulation in my attached file, and I would like to construct the Xpath syntax with (Sex = female,Turmor =  absent , and dose =  control)  in order to get to my numerical value 6.0 in that cell. I would like to ask if any of you have experienced with writting Xpath and know how to write a Xpath syntax for Cross Tabulation with multiple layers then please give me some hints on how to approach this. Also , please show me resources on how to write Xpath for crosss tabulation table with multiple layers if you happen to know any.

Thank you so much in advance,










  • JonPeck
    269 Posts

    Re: How to write Xpath syntax for pivot table ?


    Here's an example of the XPath expression for a table produced as (using employee data.sav)

    oms select tables /if subtypes=['Crosstabulation']
    /destination outfile ="c:/temp/xtab.xml" format = oxml.
      /TABLES=jobcat BY minority BY gender

    This expression picks out females with jobcat clerical (1) and minority = 0 and returns the count and the row pct.


    Ideally you would use an editor that allows you to enter an xpath expression against the xml file and shows you the structure and what is selected.  If you are evaluting with Python, there are some helper functions in the spssaux module (GetValuesFromXmlWorkspace) and the pivottablestruct.displayTableStructure modules.  There is also a good discussion of the xml table structure in the OMS help.