title: How to retrieve some output values from SPSS Custom Tables?
body: <p>I have been trying to retrieve some specific output values from SPSS Custom Tables and export them to Excel.
  The problem is my Ctables syntax generates 2 different tables and I want to retrieve some specific output values from both these tables and then export to Excel.
  <a href="http://imgur.com/xKz4KTu" rel="nofollow">Link to screenshot of SPSS custom tables</a>. I have highlighted the values in red that I want to retrieve. I am trying to retrieve these values in XML format, but I am getting an error message. Here is the code.</p>
  
  <pre><code>      *1. Retrieve some output values and insert them into text.
   begin program.
  import spssaux
  gar="CTABLES
      /VLABELS VARIABLES=Institution RES_PAY Status DISPLAY=LABEL
      /TABLE  Status [C] &gt; RES_PAY [C] BY Institution [C][COUNT F40.0, COLPCT.COUNT PCT40.1]
     /CATEGORIES VARIABLES=Institution ORDER=A KEY=VALUE EMPTY=INCLUDE  TOTAL=YES POSITION=AFTER
     /CATEGORIES VARIABLES=RES_PAY EMPTY=INCLUDE
     /CATEGORIES VARIABLES=Status ORDER=A KEY=VALUE EMPTY=INCLUDE
     /SIGTEST TYPE=CHISQUARE ALPHA=0.05 INCLUDEMRSETS=YES  CATEGORIES=ALLVISIBLE."
  
  
     cmd = spssaux.CreateXMLOutput(gar, visible=True)
     result=spssaux.GetValuesFromXMLWorkspace(cmd, 'CTABLES', cellAttrib ='text',colCategory='Cat1', rowCategory='Research with pay',rowSubCategory='Yes')
     result1=spssaux.GetValuesFromXMLWorkspace(cmd, 'CTABLES', tableSubtype='CHISQUARE', cellAttrib = 'text',colCategory='Status', rowCategory='Research with pay',rowSubCategory='Sig.')
     OUTPUT NEW
     print result[1]
     print result1[1]
  
     end program.
  
    *2. Export output to Excel.
  
    OUTPUT EXPORT
    /CONTENTS EXPORT= ALL LAYERS=PRINTSETTING MODELVIEWS=PRINTSETTING
   /XLSX DOCUMENTFILE='U:/report1.xlsx' 
   OPERATION=CREATEFILE 
   LOCATION=STARTCELL('C4') NOTESCAPTIONS=YES.
  </code></pre>
  
  <p>This is the error message that I am getting</p>
  
  <pre><code> File "&lt;string&gt;", line 4
      gar="CTABLES
       SyntaxError: EOL while scanning string literal      ^
  </code></pre>
  
  <p>Can anyone please help me with the code?</p>