<?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: Statistics in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Statistics/m-p/474682#M121988</link>
    <description>&lt;P&gt;Hi Tobias and welcome to the SAS Support Communities!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let me start with saying that I wish I'd been assigned homework like this, involving SAS, when I studied mathematics 25 years ago ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think, the answer to the second question will help you to answer the other two questions. So, let's tackle this first.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Even without being experts for PROC IML you and I can see that the first three statements after "PROC IML;" assign scalar numeric values to variables named &lt;FONT face="courier new,courier"&gt;n&lt;/FONT&gt;, &lt;FONT face="courier new,courier"&gt;pi&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;alpha&lt;/FONT&gt;. It is likewise obvious that the subsequent&amp;nbsp;DO loop will iterate the statements &lt;FONT face="courier new,courier"&gt;X =&lt;/FONT&gt;..., &lt;FONT face="courier new,courier"&gt;p =&lt;/FONT&gt; ..., etc. until &lt;FONT face="courier new,courier"&gt;data =&lt;/FONT&gt; ... 10000 times. The assumption that all those values calculated during the 10000 iterations must be stored somewhere to make them available is&amp;nbsp;confirmed by looking up the meaning of the // and || operators and the CREATE and APPEND statements in the &lt;A href="http://documentation.sas.com/?docsetId=imlug&amp;amp;docsetTarget=imlug_langref_toc.htm&amp;amp;docsetVersion=14.3&amp;amp;locale=de" target="_blank"&gt;IML documentation&lt;/A&gt;. More precisely, &lt;FONT face="courier new,courier"&gt;p&lt;/FONT&gt;, &lt;FONT face="courier new,courier"&gt;b_l&lt;/FONT&gt;, &lt;FONT face="courier new,courier"&gt;b_u&lt;/FONT&gt;, &lt;FONT face="courier new,courier"&gt;d_l&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;d_u&lt;/FONT&gt; end up as variables COL1, ..., COL5, respectively, in a SAS dataset named SIM_BINOMIAL, which has 10000 observations -- one from each iteration of the DO loop.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The name of this dataset gives you a strong hint as to which statistical distribution is primarily involved here. Actually, there are &lt;EM&gt;two&lt;/EM&gt; different distributions involved, as you will see when you look up the &lt;A href="http://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n171sw5z3652h3n1ufcldur0inb4.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;RANBIN&lt;/A&gt;&amp;nbsp;and &lt;A href="http://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n0gygnmlse8n5in1sp1u2n97lpej.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;PROBIT&lt;/A&gt; functions (which are used in the DO loop) in the SAS documentation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now think about what type of random experiment is associated with the first of these two statistical distributions and&amp;nbsp;how the parameters &lt;FONT face="courier new,courier"&gt;n&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;pi&lt;/FONT&gt; as well as the result &lt;FONT face="courier new,courier"&gt;X&lt;/FONT&gt; (=&lt;FONT face="courier new,courier"&gt;x&lt;/FONT&gt;) of the RANBIN call relate to such an experiment. This together with the fact that COL1 contains the values &lt;FONT face="courier new,courier"&gt;x/n&lt;/FONT&gt; previously stored in variable &lt;FONT face="courier new,courier"&gt;p&lt;/FONT&gt; should help you to answer the first question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Finally, how do (lower and upper) "confidence bounds" come into play? Well, can you spot the formula used for two of the variables calculated in the DO loop in &lt;A href="https://en.wikipedia.org/wiki/Binomial_proportion_confidence_interval" target="_blank"&gt;this Wikipedia article&lt;/A&gt;? (Hint: &lt;FONT face="courier new,courier"&gt;l&lt;/FONT&gt; stands for "lower", &lt;FONT face="courier new,courier"&gt;u&lt;/FONT&gt; for "upper". Guess what &lt;FONT face="courier new,courier"&gt;b&lt;/FONT&gt; stands for.) The two variables in question are also contained in dataset SIM_BINOMIAL. Using the MEANS procedure, some descriptive statistics have already been computed for variables COL1, .., COL5, for example "Mittelwert" (English: mean). That is to say, you don't have to calculate them. They're already there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps. Please feel free to ask if something is still unclear.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards from Germany,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Reinhard&lt;/P&gt;</description>
    <pubDate>Sat, 30 Jun 2018 16:59:12 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2018-06-30T16:59:12Z</dc:date>
    <item>
      <title>Statistics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Statistics/m-p/474672#M121981</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have some very basic questions. I am working on my homework at the moment and our prof. gave us this code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;PROC IML;

n = 50;

pi = 0.5;

alpha = 0.025;

DO i = 1 TO 10000;

X = RANBIN(1,n,pi);

p = x/n; var = p*(1-p);

b_l = p - PROBIT(1-alpha/2) * sqrt(var) / sqrt(n);

b_u = p + PROBIT(1-alpha/2) * sqrt(var) / sqrt(n);

d_l = pi &amp;lt; b_l; d_u = pi &amp;gt; b_u; data = data//(p||b_l||b_u||d_l||d_u);

END;

CREATE sim_binomial FROM data;

APPEND FROM data; QUIT;

PROC MEANS data=sim_binomial;

VAR COL1-COL5;

RUN;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and this output:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot_16.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21513i7B02E7E11D048D5A/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot_16.png" alt="Screenshot_16.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;we have to answer some questions about the output and code. I am not able to answer the following of them:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What describes&amp;nbsp; variable&amp;nbsp;COL1 ?&lt;/P&gt;&lt;P&gt;Wich distribution does we use ? (Where can i see that ?)&lt;/P&gt;&lt;P&gt;What are the means of the confidence bounds ? (How do I calculate that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know that this are very easy questions for you, but they are very difficult for me.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anybody please help me out ?&lt;/P&gt;&lt;P&gt;Thank you so much !&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Tobias&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 30 Jun 2018 14:22:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Statistics/m-p/474672#M121981</guid>
      <dc:creator>Tobias1997</dc:creator>
      <dc:date>2018-06-30T14:22:34Z</dc:date>
    </item>
    <item>
      <title>Re: Statistics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Statistics/m-p/474682#M121988</link>
      <description>&lt;P&gt;Hi Tobias and welcome to the SAS Support Communities!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let me start with saying that I wish I'd been assigned homework like this, involving SAS, when I studied mathematics 25 years ago ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think, the answer to the second question will help you to answer the other two questions. So, let's tackle this first.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Even without being experts for PROC IML you and I can see that the first three statements after "PROC IML;" assign scalar numeric values to variables named &lt;FONT face="courier new,courier"&gt;n&lt;/FONT&gt;, &lt;FONT face="courier new,courier"&gt;pi&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;alpha&lt;/FONT&gt;. It is likewise obvious that the subsequent&amp;nbsp;DO loop will iterate the statements &lt;FONT face="courier new,courier"&gt;X =&lt;/FONT&gt;..., &lt;FONT face="courier new,courier"&gt;p =&lt;/FONT&gt; ..., etc. until &lt;FONT face="courier new,courier"&gt;data =&lt;/FONT&gt; ... 10000 times. The assumption that all those values calculated during the 10000 iterations must be stored somewhere to make them available is&amp;nbsp;confirmed by looking up the meaning of the // and || operators and the CREATE and APPEND statements in the &lt;A href="http://documentation.sas.com/?docsetId=imlug&amp;amp;docsetTarget=imlug_langref_toc.htm&amp;amp;docsetVersion=14.3&amp;amp;locale=de" target="_blank"&gt;IML documentation&lt;/A&gt;. More precisely, &lt;FONT face="courier new,courier"&gt;p&lt;/FONT&gt;, &lt;FONT face="courier new,courier"&gt;b_l&lt;/FONT&gt;, &lt;FONT face="courier new,courier"&gt;b_u&lt;/FONT&gt;, &lt;FONT face="courier new,courier"&gt;d_l&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;d_u&lt;/FONT&gt; end up as variables COL1, ..., COL5, respectively, in a SAS dataset named SIM_BINOMIAL, which has 10000 observations -- one from each iteration of the DO loop.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The name of this dataset gives you a strong hint as to which statistical distribution is primarily involved here. Actually, there are &lt;EM&gt;two&lt;/EM&gt; different distributions involved, as you will see when you look up the &lt;A href="http://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n171sw5z3652h3n1ufcldur0inb4.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;RANBIN&lt;/A&gt;&amp;nbsp;and &lt;A href="http://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n0gygnmlse8n5in1sp1u2n97lpej.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;PROBIT&lt;/A&gt; functions (which are used in the DO loop) in the SAS documentation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now think about what type of random experiment is associated with the first of these two statistical distributions and&amp;nbsp;how the parameters &lt;FONT face="courier new,courier"&gt;n&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;pi&lt;/FONT&gt; as well as the result &lt;FONT face="courier new,courier"&gt;X&lt;/FONT&gt; (=&lt;FONT face="courier new,courier"&gt;x&lt;/FONT&gt;) of the RANBIN call relate to such an experiment. This together with the fact that COL1 contains the values &lt;FONT face="courier new,courier"&gt;x/n&lt;/FONT&gt; previously stored in variable &lt;FONT face="courier new,courier"&gt;p&lt;/FONT&gt; should help you to answer the first question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Finally, how do (lower and upper) "confidence bounds" come into play? Well, can you spot the formula used for two of the variables calculated in the DO loop in &lt;A href="https://en.wikipedia.org/wiki/Binomial_proportion_confidence_interval" target="_blank"&gt;this Wikipedia article&lt;/A&gt;? (Hint: &lt;FONT face="courier new,courier"&gt;l&lt;/FONT&gt; stands for "lower", &lt;FONT face="courier new,courier"&gt;u&lt;/FONT&gt; for "upper". Guess what &lt;FONT face="courier new,courier"&gt;b&lt;/FONT&gt; stands for.) The two variables in question are also contained in dataset SIM_BINOMIAL. Using the MEANS procedure, some descriptive statistics have already been computed for variables COL1, .., COL5, for example "Mittelwert" (English: mean). That is to say, you don't have to calculate them. They're already there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps. Please feel free to ask if something is still unclear.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards from Germany,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Reinhard&lt;/P&gt;</description>
      <pubDate>Sat, 30 Jun 2018 16:59:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Statistics/m-p/474682#M121988</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2018-06-30T16:59:12Z</dc:date>
    </item>
    <item>
      <title>Re: Statistics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Statistics/m-p/474684#M121989</link>
      <description>&lt;P&gt;Hello Reinhard,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you very much !&lt;/P&gt;&lt;P&gt;I really appreciate your help. Now I understand my homework.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Tobias&lt;/P&gt;</description>
      <pubDate>Sat, 30 Jun 2018 17:43:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Statistics/m-p/474684#M121989</guid>
      <dc:creator>Tobias1997</dc:creator>
      <dc:date>2018-06-30T17:43:45Z</dc:date>
    </item>
  </channel>
</rss>

