Retreiving SPSS output

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Retreiving SPSS output

Blankdots
I'm writing a script that automatically performs KM analysis on 50000
variables then retrieves the sigma value from each analysis. When i run the
code, it prints empty brackets [].

here is the xml file

<?xml version="1.0" encoding="UTF-16"?>
-<outputTree xsi:schemaLocation="http://xml.spss.com/spss/oms
http://xml.spss.com/spss/oms/spss-output-1.7.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xml.spss.com/spss/oms">-<command lang="en" text="Kaplan-Meier"
displayTableVariables="label" displayTableValues="label"
displayOutlineVariables="label" displayOutlineValues="label"
command="Kaplan-Meier">-<pivotTable text="Overall Comparisons"
subType="Overall Comparisons"><caption text="Test of equality of survival
distributions for the different levels of SLC3A2_group."/>-<dimension
text="Test Type" axis="row">-<category text="Log Rank (Mantel-Cox)
">-<dimension text="Statistics" axis="column">+<category
text="Chi-Square">-<category text="df"><cell text="1"
number="1"/></category>-<category text="Sig."><cell text=".205"
number="0.20491462905454"
decimals="3"/></category></dimension></category></dimension></pivotTable></command></outputTree>

and here is part of the script.


for genes in genelist:
    spss.Submit(r"""
    OMS
        /SELECT TABLES
        /IF COMMANDS=['Kaplan-Meier'] SUBTYPES=['Overall Comparisons']
        /DESTINATION FORMAT=OXML XMLWORKPLACE='KM_table'
        /TAG='km_out'.

    KM Overall_Survival_FT BY %s
        /STATUS=ten_year_css(1)
        /PRINT NONE
        /TEST LOGRANK
        /COMPARE OVERALL POOLED.

    OMSEND TAG='km_out'. """%(genes))

    handle="KM_table"
    context="/outputTree"
    xpath="//command[@lang='en']\
            /pivotTable[@text='Overall Comparisons']\
            /dimension[@text='Test Type']\
            /category[@text='Log Rank (Mantel-Cox)']\
            /dimension[@text='Statistics']\
            /category[@text='Sig.']\
            /cell/@text"

    result=spss.EvaluateXPath(handle,context,xpath)
    print result


changing the last line to print result [0] doesn't work either.


any help would be kindly appreciated.

Ideally i want to retrieve each sigma value and save it to an excel sheet on
a new row.




--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Retreiving-SPSS-output-tp5717624.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD