<?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 Fisher test with Monte Carlo in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Fisher-test-with-Monte-Carlo/m-p/449619#M113174</link>
    <description>&lt;P&gt;Using SAS 9.4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have formatted a variable race&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;format&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;value&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; $Race &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'C'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Caucasian'&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'AA'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'African American'&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;other = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Unknown/Other'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;and this works for some tests, (eg)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;freq&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = mylib.a (where=(Used_recommendation = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Yes'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;));&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;tables&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp; Race /&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;chisq&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;list&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;missing&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;nocum&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;format&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Race &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;$Race.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;title&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Table &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; ‘Demographics’;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;However my format does not work when I run a fisher exact test with monte carlo estimates (eg)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;freq&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = mylib.a;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;tables&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Used_recommendation*Race;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;format&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Race &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;$Race.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;exact&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;fisher&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; /mc;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;It comes up with my Caucasian and African American groups but neglects the other/unknown category. Am I doing something wrong? Is their a better way to write my code so that it would work? Thank you&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 29 Mar 2018 12:02:28 GMT</pubDate>
    <dc:creator>GS2</dc:creator>
    <dc:date>2018-03-29T12:02:28Z</dc:date>
    <item>
      <title>Fisher test with Monte Carlo</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Fisher-test-with-Monte-Carlo/m-p/449619#M113174</link>
      <description>&lt;P&gt;Using SAS 9.4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have formatted a variable race&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;format&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;value&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; $Race &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'C'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Caucasian'&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'AA'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'African American'&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;other = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Unknown/Other'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;and this works for some tests, (eg)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;freq&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = mylib.a (where=(Used_recommendation = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Yes'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;));&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;tables&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp; Race /&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;chisq&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;list&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;missing&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;nocum&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;format&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Race &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;$Race.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;title&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Table &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; ‘Demographics’;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;However my format does not work when I run a fisher exact test with monte carlo estimates (eg)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;freq&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = mylib.a;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;tables&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Used_recommendation*Race;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;format&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Race &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;$Race.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;exact&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;fisher&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; /mc;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;It comes up with my Caucasian and African American groups but neglects the other/unknown category. Am I doing something wrong? Is their a better way to write my code so that it would work? Thank you&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2018 12:02:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Fisher-test-with-Monte-Carlo/m-p/449619#M113174</guid>
      <dc:creator>GS2</dc:creator>
      <dc:date>2018-03-29T12:02:28Z</dc:date>
    </item>
    <item>
      <title>Re: Fisher test with Monte Carlo</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Fisher-test-with-Monte-Carlo/m-p/449660#M113201</link>
      <description>&lt;P&gt;Do you use missing values to code the "Other" category, or are the values nonmissing? (Missing values will be ignored, even if they are formatted.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you see any warnings in the SAS log? How many observations in the data? Exact tests can be computing intensive, so&amp;nbsp;you might get an error message for huge data sets,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your PROC FREQ statement looks correct. It runs on the following simulated data. I conclude&amp;nbsp;that there is something specific to your data that is causing the issue:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Have;
array RaceCode[3] $2 ("C" "AA" "O");
call streaminit(321);
do i = 1 to 1000;
   k = rand("Table", 0.45, 0.35, 0.2);
   Race = RaceCode[k];
   Used_recommendation = rand("Bernoulli", 0.6*k/4);
   output;
end;
keep i Race Used_recommendation;
run;

proc format;
value $Race 'C' = 'Caucasian'
'AA' = 'African American'
other = 'Unknown/Other';
run;
 
proc freq data = Have;
tables Used_recommendation*Race;
format Race $Race.;
exact fisher /mc;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Mar 2018 15:03:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Fisher-test-with-Monte-Carlo/m-p/449660#M113201</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2018-03-29T15:03:33Z</dc:date>
    </item>
    <item>
      <title>Re: Fisher test with Monte Carlo</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Fisher-test-with-Monte-Carlo/m-p/449662#M113203</link>
      <description>&lt;P&gt;I am using 'other'&amp;nbsp; to code for missing data. Would it be more effective to use '.' to code for the missing data?&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2018 14:02:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Fisher-test-with-Monte-Carlo/m-p/449662#M113203</guid>
      <dc:creator>GS2</dc:creator>
      <dc:date>2018-03-29T14:02:10Z</dc:date>
    </item>
    <item>
      <title>Re: Fisher test with Monte Carlo</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Fisher-test-with-Monte-Carlo/m-p/449665#M113204</link>
      <description>&lt;P&gt;Ah! Well that explains it. By default PROC FREQ drops observations that have missing values. You need to tell it that it should consider missing values as a valid category:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data = Have;
   tables Used_recommendation*Race / MISSING; /* &amp;lt;== */
   format Race $Race.;
   exact fisher /mc;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Mar 2018 14:05:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Fisher-test-with-Monte-Carlo/m-p/449665#M113204</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2018-03-29T14:05:41Z</dc:date>
    </item>
    <item>
      <title>Re: Fisher test with Monte Carlo</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Fisher-test-with-Monte-Carlo/m-p/449670#M113206</link>
      <description>&lt;P&gt;Is their a way to write that into my sas format code so that I can name the missing values? Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2018 14:29:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Fisher-test-with-Monte-Carlo/m-p/449670#M113206</guid>
      <dc:creator>GS2</dc:creator>
      <dc:date>2018-03-29T14:29:33Z</dc:date>
    </item>
    <item>
      <title>Re: Fisher test with Monte Carlo</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Fisher-test-with-Monte-Carlo/m-p/449690#M113214</link>
      <description>&lt;P&gt;You already have it covered. The missing values will be labeled as&amp;nbsp;&lt;SPAN&gt;'Unknown/Other',&amp;nbsp;according&amp;nbsp;to your format.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2018 15:06:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Fisher-test-with-Monte-Carlo/m-p/449690#M113214</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2018-03-29T15:06:21Z</dc:date>
    </item>
  </channel>
</rss>

