<?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: Is there a SAS command to calculate the probability of one event? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Is-there-a-SAS-command-to-calculate-the-probability-of-one-event/m-p/542326#M149853</link>
    <description>&lt;P&gt;The short answer is: there is not. If you want the probabilities for each result, try something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data prob;
  array prob(2:12) prob2-prob12;
  do d1=1 to 6;
    do d2=1 to 6;
      prob(d1+d2)+1/36;
      end;
   end;
  drop d1 d2;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But if you just want the probability for each throw, it is 1/(6**2)=1/36. I do not think there is a special function for that.&lt;/P&gt;</description>
    <pubDate>Tue, 12 Mar 2019 11:09:27 GMT</pubDate>
    <dc:creator>s_lassen</dc:creator>
    <dc:date>2019-03-12T11:09:27Z</dc:date>
    <item>
      <title>Is there a SAS command to calculate the probability of one event?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-a-SAS-command-to-calculate-the-probability-of-one-event/m-p/542273#M149825</link>
      <description>&lt;P&gt;I have the following code that simulates the 36 possible outcomes of throwing two six-sided dice, but I wanted to know if there is a SAS command that will tell me that the probability of any one throw is 1/36 or approximately 2.78%? Thank you in advance for any help you can provide me!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code:&amp;nbsp;&lt;/P&gt;&lt;P&gt;data auto;&lt;BR /&gt;do D1= 1 to 6;&lt;BR /&gt;do D2= 1 to 6;&lt;BR /&gt;X = sum(D1, D2);&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;end;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2019 04:21:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-a-SAS-command-to-calculate-the-probability-of-one-event/m-p/542273#M149825</guid>
      <dc:creator>Fara_I</dc:creator>
      <dc:date>2019-03-12T04:21:23Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a SAS command to calculate the probability of one event?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-a-SAS-command-to-calculate-the-probability-of-one-event/m-p/542326#M149853</link>
      <description>&lt;P&gt;The short answer is: there is not. If you want the probabilities for each result, try something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data prob;
  array prob(2:12) prob2-prob12;
  do d1=1 to 6;
    do d2=1 to 6;
      prob(d1+d2)+1/36;
      end;
   end;
  drop d1 d2;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But if you just want the probability for each throw, it is 1/(6**2)=1/36. I do not think there is a special function for that.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2019 11:09:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-a-SAS-command-to-calculate-the-probability-of-one-event/m-p/542326#M149853</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2019-03-12T11:09:27Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a SAS command to calculate the probability of one event?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-a-SAS-command-to-calculate-the-probability-of-one-event/m-p/542341#M149858</link>
      <description>&lt;P&gt;Calling&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2019 12:18:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-a-SAS-command-to-calculate-the-probability-of-one-event/m-p/542341#M149858</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-03-12T12:18:41Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a SAS command to calculate the probability of one event?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-a-SAS-command-to-calculate-the-probability-of-one-event/m-p/542452#M149888</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/252980"&gt;@Fara_I&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have the following code that simulates the 36 possible outcomes of throwing two six-sided dice, but I wanted to know if there is a SAS command that will tell me that the probability of any one throw is 1/36 or approximately 2.78%? Thank you in advance for any help you can provide me!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the code:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data auto;&lt;BR /&gt;do D1= 1 to 6;&lt;BR /&gt;do D2= 1 to 6;&lt;BR /&gt;X = sum(D1, D2);&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;end;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;PRE&gt;proc freq data=auto;
   table x;
run;&lt;/PRE&gt;
&lt;P&gt;With display, by default, the percent of the distribution points of the X variable. That "Percent" would also be the probability distribution of X, barring rounding error. You can send the output to a data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want the distribution of each possible die toss then you need to create an ordered pair such as:&lt;/P&gt;
&lt;PRE&gt;data auto;
   do D1= 1 to 6;
      do D2= 1 to 6;
         X = sum(D1, D2);
         y = cats(d1,d2);
         output;
      end;
   end;
run;

proc freq data=auto;
   table x y;
run;&lt;/PRE&gt;
&lt;P&gt;And proc freq again shows the percent, or probability, of each ordered pair.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For any given PERMUTATION of items the probability is basically 1/(n1*n2*n3*…*nx) where each n is the number of possibilities for that position. Simple 6-sided die the N is always&amp;nbsp;6 so the probability of any given ordered pair is 1/(6^n) for any given number of dice. 6^n is 6 to the nth power.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Combinatorics is somewhat fun, but I'm possibly warped.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2019 15:42:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-a-SAS-command-to-calculate-the-probability-of-one-event/m-p/542452#M149888</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-03-12T15:42:27Z</dc:date>
    </item>
  </channel>
</rss>

