<?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: Calculating Desired and Actual CI Half Width/ Margin of error in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Calculating-Desired-and-Actual-CI-Half-Width-Margin-of-error/m-p/719636#M27676</link>
    <description>&lt;P&gt;The 'Actual CI Half Width' is (U - L)/2.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In case anyone else wants to understand the program, the OP is calculating &lt;A href="https://go.documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=statug&amp;amp;docsetTarget=statug_freq_details37.htm&amp;amp;locale=en" target="_self"&gt;the exact Clopper-Pearson interval for the binomial proportion&lt;/A&gt;. The Clopper-Pearson estimate is used because the proportion of successes (p) is close to 1, which violates the usual scenario in which the more familiar Wald interval is applicable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm still not sure what the 'Desired CI Half-Width' column is, but I think it is a "given" column that is provided for us. It looks like the task is similar to a power or sample size computation. The second column is the "target" and the other columns show the CI for the proportion that comes closest to matching this target value.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 16 Feb 2021 13:43:40 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2021-02-16T13:43:40Z</dc:date>
    <item>
      <title>Calculating Desired and Actual CI Half Width/ Margin of error</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Calculating-Desired-and-Actual-CI-Half-Width-Margin-of-error/m-p/719351#M27656</link>
      <description>&lt;P&gt;&lt;STRONG&gt;I want this output:&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Sample Size&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Desired&lt;BR /&gt;CI Half Width (%)&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Success&lt;BR /&gt;Count&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Success Rate (%)&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Lower Limit of&lt;BR /&gt;95% Exact CI&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Upper Limit of&lt;BR /&gt;95% Exact CI&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Actual&lt;BR /&gt;CI Half Width (%)&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;120&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&amp;nbsp; 1.00&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;120&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;100.00&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&amp;nbsp;96.97&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;100.00&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&amp;nbsp; 1.51&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;120&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&amp;nbsp; 2.50&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;119&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&amp;nbsp;99.17&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&amp;nbsp;95.44&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&amp;nbsp;99.98&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&amp;nbsp; 2.27&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;120&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&amp;nbsp; 3.50&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;117&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&amp;nbsp;97.50&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&amp;nbsp;92.87&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&amp;nbsp;99.48&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&amp;nbsp; 3.31&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;To validate the above table, I tried the below program:&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;%let N=120;&lt;BR /&gt;data CIop;&lt;BR /&gt;do i=117 to &amp;amp;N;&lt;BR /&gt;retain N x p L U alpha;&lt;BR /&gt;p=i/&amp;amp;N;&lt;BR /&gt;alpha=0.05;&lt;BR /&gt;if p=0 then L=0;&lt;BR /&gt;if p=1 then U=1;&lt;BR /&gt;if p ne 0 then L=(1-betainv(1-alpha/2, &amp;amp;N-i+1, i));&lt;BR /&gt;if p ne 1 then U=betainv (1-alpha/2, i+1, &amp;amp;N-i);&lt;BR /&gt;N=&amp;amp;N;&lt;BR /&gt;x=i;&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;BR /&gt;proc print data=CIop;&lt;BR /&gt;var N x p L U;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I got everything in the above table except the 'Desired CI Half Width' and 'Actual CI Half Width'.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;How can i get the above complete table with Desired and Expected CI Half Width.&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much!&amp;nbsp;&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>Mon, 15 Feb 2021 14:49:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Calculating-Desired-and-Actual-CI-Half-Width-Margin-of-error/m-p/719351#M27656</guid>
      <dc:creator>Akter</dc:creator>
      <dc:date>2021-02-15T14:49:14Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Desired and Actual CI Half Width/ Margin of error</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Calculating-Desired-and-Actual-CI-Half-Width-Margin-of-error/m-p/719352#M27657</link>
      <description>&lt;P&gt;Please explain further. How can it be that the table you want has 7 columns but your PROC PRINT only mentions 5 variables?&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2021 14:56:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Calculating-Desired-and-Actual-CI-Half-Width-Margin-of-error/m-p/719352#M27657</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-02-15T14:56:17Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Desired and Actual CI Half Width/ Margin of error</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Calculating-Desired-and-Actual-CI-Half-Width-Margin-of-error/m-p/719357#M27658</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Thank you, Paige Miller. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I don't&amp;nbsp;know what should be the program i need to write for&amp;nbsp;these additional two variables, Desired&amp;nbsp;and Actual CI Half Width. That's&amp;nbsp;why i did not put these two variable in the proc print.&amp;nbsp; At that moment, pls forget the proc print part. Compare my program and the expected output table what additional program i need to write to get the output table or how differently i can write my program.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Respectfully,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2021 15:08:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Calculating-Desired-and-Actual-CI-Half-Width-Margin-of-error/m-p/719357#M27658</guid>
      <dc:creator>Akter</dc:creator>
      <dc:date>2021-02-15T15:08:15Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Desired and Actual CI Half Width/ Margin of error</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Calculating-Desired-and-Actual-CI-Half-Width-Margin-of-error/m-p/719358#M27659</link>
      <description>&lt;P&gt;How do you calculate these two values? What is the formula? (I realize you don't know how to program it in SAS, just tell us the formula for these).&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2021 15:21:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Calculating-Desired-and-Actual-CI-Half-Width-Margin-of-error/m-p/719358#M27659</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-02-15T15:21:14Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Desired and Actual CI Half Width/ Margin of error</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Calculating-Desired-and-Actual-CI-Half-Width-Margin-of-error/m-p/719636#M27676</link>
      <description>&lt;P&gt;The 'Actual CI Half Width' is (U - L)/2.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In case anyone else wants to understand the program, the OP is calculating &lt;A href="https://go.documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=statug&amp;amp;docsetTarget=statug_freq_details37.htm&amp;amp;locale=en" target="_self"&gt;the exact Clopper-Pearson interval for the binomial proportion&lt;/A&gt;. The Clopper-Pearson estimate is used because the proportion of successes (p) is close to 1, which violates the usual scenario in which the more familiar Wald interval is applicable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm still not sure what the 'Desired CI Half-Width' column is, but I think it is a "given" column that is provided for us. It looks like the task is similar to a power or sample size computation. The second column is the "target" and the other columns show the CI for the proportion that comes closest to matching this target value.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2021 13:43:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Calculating-Desired-and-Actual-CI-Half-Width-Margin-of-error/m-p/719636#M27676</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2021-02-16T13:43:40Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Desired and Actual CI Half Width/ Margin of error</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Calculating-Desired-and-Actual-CI-Half-Width-Margin-of-error/m-p/719644#M27677</link>
      <description>Thank you &lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;. Great help!</description>
      <pubDate>Tue, 16 Feb 2021 14:43:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Calculating-Desired-and-Actual-CI-Half-Width-Margin-of-error/m-p/719644#M27677</guid>
      <dc:creator>Akter</dc:creator>
      <dc:date>2021-02-16T14:43:10Z</dc:date>
    </item>
  </channel>
</rss>

