<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Automate odds ratio to populate a table in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Automate-odds-ratio-to-populate-a-table/m-p/585132#M79080</link>
    <description>Thanks so much!!</description>
    <pubDate>Fri, 23 Dec 2022 21:39:13 GMT</pubDate>
    <dc:creator>lily1287</dc:creator>
    <dc:date>2022-12-23T21:39:13Z</dc:date>
    <item>
      <title>Automate odds ratio to populate a table</title>
      <link>https://community.jmp.com/t5/Discussions/Automate-odds-ratio-to-populate-a-table/m-p/584961#M79071</link>
      <description>&lt;P&gt;Hi all! Is there an easy way to automate a table like the following for a large data set? Essentially I'm reporting my data in the following way with number and percentage in each group and the odds ratio with the confidence interval:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Total n (%)&lt;/TD&gt;&lt;TD&gt;Survived n (%)&lt;/TD&gt;&lt;TD&gt;Died n (%)&lt;/TD&gt;&lt;TD&gt;OR (CI)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Female&lt;/TD&gt;&lt;TD&gt;x (x%)&lt;/TD&gt;&lt;TD&gt;x (x%)&lt;/TD&gt;&lt;TD&gt;x (x%)&lt;/TD&gt;&lt;TD&gt;x.xx (x.xx-x.xx)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Heart disease&lt;/TD&gt;&lt;TD&gt;x (x%)&lt;/TD&gt;&lt;TD&gt;x (x%)&lt;/TD&gt;&lt;TD&gt;x (x%)&lt;/TD&gt;&lt;TD&gt;x.xx (x.xx-x.xx)&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been doing my analysis using fit x by y, adding in the odds ratio, and looking at the contingency table and odds ratio then manually typing it into word. I know I should be able to use the tabulate function to streamline the process via excel to get the middle three columns but am interested to know if someone has a good way to list the OR in a table. Even if it's something like this it would be helpful, especially if you can make it into a script to run for all the variables I want stats on:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;OR&lt;/TD&gt;&lt;TD&gt;lower 95%&lt;/TD&gt;&lt;TD&gt;Upper 95%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Female&lt;/TD&gt;&lt;TD&gt;x.xx&lt;/TD&gt;&lt;TD&gt;x.xx&lt;/TD&gt;&lt;TD&gt;x.xx&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Heart disease&lt;/TD&gt;&lt;TD&gt;x.xx&lt;/TD&gt;&lt;TD&gt;x.xx&lt;/TD&gt;&lt;TD&gt;x.xx&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any tips or tricks? I'm not great at using the JSL code but am working on learning!&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:58:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Automate-odds-ratio-to-populate-a-table/m-p/584961#M79071</guid>
      <dc:creator>lily1287</dc:creator>
      <dc:date>2023-06-10T23:58:54Z</dc:date>
    </item>
    <item>
      <title>Re: Automate odds ratio to populate a table</title>
      <link>https://community.jmp.com/t5/Discussions/Automate-odds-ratio-to-populate-a-table/m-p/585094#M79079</link>
      <description>&lt;P&gt;There's a way to extract information from reports in JMP using a combination of using the GUI to investigate the report structure and scripting to pull specific information.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Step 1 is to do your analysis, then right click on the header closest to the information you want (red space below), then select Edit...Show Tree Structure.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Jed_Campbell_1-1671812127490.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/48672i9A1E0D75455DEA87/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Jed_Campbell_1-1671812127490.png" alt="Jed_Campbell_1-1671812127490.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Jed_Campbell_0-1671812098059.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/48671i38D96A6CF80ED95B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Jed_Campbell_0-1671812098059.png" alt="Jed_Campbell_0-1671812098059.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;In the window that pops up, find the info you're looking for, then the name of the header just above it in the hierarchy. In this case,&amp;nbsp; NumberColBox(8) has the Odds Ratio, so you'll need to remember NumberColBox(8) for the scripting step.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Jed_Campbell_2-1671812366040.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/48673i7C1F018441A40C4B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Jed_Campbell_2-1671812366040.png" alt="Jed_Campbell_2-1671812366040.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Step 2 is to write the script. The first few lines in the script below are just for opening a file that this will work on; the magic starts at the "Export the report layer" comment. Basically, you're creating a separate object that has a copy of all the hierarchy of the report in it, then querying that separate object to get the text/number you need. In the script below, I send the odds ratio to the clipboard, since you mentioned needing to paste it. You could also use scripting to do other things with the value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
//open the data file and run analysis, including odds ratio
dt = Open( "$SAMPLE_DATA/Lung Cancer.jmp" );
obj = dt &amp;lt;&amp;lt; Contingency( Y( :Lung Cancer ), X( :Smoker ), Freq( :Count ), Odds Ratio( 1 ) );

//export the report layer, so it can be queried
r = obj &amp;lt;&amp;lt; report;

//from looking through the "Show Tree Structure" manually to find the number needed
oddsratio = r[NumberColBox(8)] &amp;lt;&amp;lt; Get; //pulls a list of what in that NumberColBox
show(oddsratio[1]); //shows the first item in the list (the odds ratio)
Set Clipboard (round(oddsratio[1],3)); //copies rounded odds ratio to the clipboard for easy pasting&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;A href="https://www.jmp.com/support/help/zh/15.2/index.shtml#page/jmp/extract-values-from-an-analysis-into-a-report.shtml" target="_self"&gt;Here's a link to a great resource&lt;/A&gt; for learning more about scripting the report layer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Dec 2022 16:26:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Automate-odds-ratio-to-populate-a-table/m-p/585094#M79079</guid>
      <dc:creator>Jed_Campbell</dc:creator>
      <dc:date>2022-12-23T16:26:07Z</dc:date>
    </item>
    <item>
      <title>Re: Automate odds ratio to populate a table</title>
      <link>https://community.jmp.com/t5/Discussions/Automate-odds-ratio-to-populate-a-table/m-p/585132#M79080</link>
      <description>Thanks so much!!</description>
      <pubDate>Fri, 23 Dec 2022 21:39:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Automate-odds-ratio-to-populate-a-table/m-p/585132#M79080</guid>
      <dc:creator>lily1287</dc:creator>
      <dc:date>2022-12-23T21:39:13Z</dc:date>
    </item>
  </channel>
</rss>

