<?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 How to calculate both 100% percent rate confidence interval in proc freq step in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-calculate-both-100-percent-rate-confidence-interval-in/m-p/480212#M24968</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to calculate a confidence interval for difference betwwen two groups while the successful rate of two groups are both 100%, I used code below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data dummy_in;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;success1 = 'Y'; trtpn = 2; count = 67; output;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;success1 = 'Y'; trtpn = 3; count = 76; output;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;success1 = 'N'; trtpn = 2; count = 0; output;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;success1 = 'N'; trtpn = 3; count = 0; output;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;proc sort; by trtpn success1;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc freq data = dummy_in ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;tables trtpn*success1/riskdiff(noninf cl=mn(correct=no) method=fm margin=0.1) alpha=.1 exact;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;weight count /zeros;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but the outputs shows: Row or column sum zero. No statistics computed for this table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know that the confidence interval can be computed using Miettinen and Nurminen method using R, but in sas, I cannot avoid the error of 'Row or column sum zero.' so no confidence interval can be outputed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would anybody can help me with this problem in SAS? Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Shuang&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 22 Jul 2018 05:25:37 GMT</pubDate>
    <dc:creator>shuang_yoyo</dc:creator>
    <dc:date>2018-07-22T05:25:37Z</dc:date>
    <item>
      <title>How to calculate both 100% percent rate confidence interval in proc freq step</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-calculate-both-100-percent-rate-confidence-interval-in/m-p/480212#M24968</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to calculate a confidence interval for difference betwwen two groups while the successful rate of two groups are both 100%, I used code below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data dummy_in;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;success1 = 'Y'; trtpn = 2; count = 67; output;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;success1 = 'Y'; trtpn = 3; count = 76; output;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;success1 = 'N'; trtpn = 2; count = 0; output;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;success1 = 'N'; trtpn = 3; count = 0; output;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;proc sort; by trtpn success1;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc freq data = dummy_in ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;tables trtpn*success1/riskdiff(noninf cl=mn(correct=no) method=fm margin=0.1) alpha=.1 exact;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;weight count /zeros;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but the outputs shows: Row or column sum zero. No statistics computed for this table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know that the confidence interval can be computed using Miettinen and Nurminen method using R, but in sas, I cannot avoid the error of 'Row or column sum zero.' so no confidence interval can be outputed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would anybody can help me with this problem in SAS? Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Shuang&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 22 Jul 2018 05:25:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-calculate-both-100-percent-rate-confidence-interval-in/m-p/480212#M24968</guid>
      <dc:creator>shuang_yoyo</dc:creator>
      <dc:date>2018-07-22T05:25:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate both 100% percent rate confidence interval in proc freq step</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-calculate-both-100-percent-rate-confidence-interval-in/m-p/480286#M24972</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/222336"&gt;@shuang_yoyo&lt;/a&gt;&amp;nbsp;and welcome to the SAS Support Communities!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think a quick-and-dirty solution would be to replace the zero counts by very small numbers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data dummy_in1;
set dummy_in;
if count=0 then count=1e-9;
run;

ods output PdiffCLs=pdcl;
proc freq data = dummy_in1;
    tables trtpn*success1/riskdiff(noninf cl=mn(correct=no) method=fm margin=0.1) alpha=.1;
    weight count /zeros;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(I omitted the &lt;FONT face="courier new,courier"&gt;exact&lt;/FONT&gt; option&amp;nbsp;to avoid the warning "Fisher's exact test cannot be computed when there are noninteger frequencies.")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Part of the output:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Confidence Limits for the Proportion (Risk) Difference
            Column 1 (success1 = N)
        Proportion Difference = 0.0000

Type                      90% Confidence Limits

Miettinen-Nurminen-Mee    -0.0344        0.0388&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But let's check if these confidence limits (which are contained in dataset &lt;FONT face="courier new,courier"&gt;pdcl&lt;/FONT&gt; with greater precision than in the output) are consistent with the formulas given in the &lt;A href="http://documentation.sas.com/?docsetId=statug&amp;amp;docsetTarget=statug_freq_details53.htm&amp;amp;docsetVersion=14.3&amp;amp;locale=en" target="_blank"&gt;documentation&lt;/A&gt;, applied to your &lt;EM&gt;original&lt;/EM&gt; dataset including the zero counts (n1 and n2 are the&amp;nbsp;row totals&amp;nbsp;n&lt;FONT size="1 2 3 4 5 6 7"&gt;1.&lt;/FONT&gt; and n&lt;FONT size="1 2 3 4 5 6 7"&gt;2.&lt;/FONT&gt;, p1h "p1 hat", p1t "p1 tilde" etc.):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
n1=67; n2=76; p1h=0; p2h=0; /* These values could be taken from PROC FREQ output for DUMMY_IN. */
alpha=.1;
set pdcl;
array cl LowerCL UpperCL;
length lhs $12;
do i=1 to 2;
  delta=cl[i];
  dh=p1h-p2h;
  theta=n2/n1;
  d=-p1h*delta*(1+delta);
  c=delta**2+delta*(2*p1h+theta+1)+p1h+theta*p2h;
  b=-(1+theta+p1h+theta*p2h+delta*(theta+2));
  a=1+theta;
  v=b**3/(3*a)**3-b*c/(6*a**2)+d/(2*a);
  u=sign(v)*sqrt(b**2/(3*a)**2-c/(3*a));
  w=(constant('pi')+arcos(v/u**3))/3;
  p1t=2*u*cos(w)-b/(3*a);
  p2t=p1t-delta;
  vdt=p1t*(1-p1t)/n1+p2t*(1-p2t)/n2; /* no factor n/(n-1) because of option "correct=no" */
  t=(dh-delta)/sqrt(vdt);
  lhs=cats('T(', vname(cl[i]), ')=');
  put lhs +(-1) t 11.8;
end;
z=probit(1-alpha/2);
put 'z_alpha/2 =' z 11.8;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;T(LowerCL)= 1.64485357
T(UpperCL)=-1.64485372
z_alpha/2 = 1.64485363&lt;/PRE&gt;
&lt;P&gt;So, both values of the test statistic or rather their &lt;EM&gt;absolute values&lt;/EM&gt; (it seems to me that the &lt;FONT face="courier new,courier"&gt;abs()&lt;/FONT&gt; is missing in the formula for the acceptance region in the documentation!) are very close to the normal quantile &lt;FONT face="courier new,courier"&gt;z_alpha/2&lt;/FONT&gt;. This indicates that&amp;nbsp;-0.0344 and 0.0388 are indeed sufficiently precise approximations of the Miettinen-Nurminen-Mee confidence limits.&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>Sun, 22 Jul 2018 22:07:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-calculate-both-100-percent-rate-confidence-interval-in/m-p/480286#M24972</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2018-07-22T22:07:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate both 100% percent rate confidence interval in proc freq step</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-calculate-both-100-percent-rate-confidence-interval-in/m-p/480346#M24983</link>
      <description>&lt;P&gt;Thanks @FreelanceReinhard ! Your answer is really helpful! Regards, Shuang&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jul 2018 06:39:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-calculate-both-100-percent-rate-confidence-interval-in/m-p/480346#M24983</guid>
      <dc:creator>shuang_yoyo</dc:creator>
      <dc:date>2018-07-23T06:39:13Z</dc:date>
    </item>
  </channel>
</rss>

