<?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: Converting Excel sampling formula to SAS code in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Converting-Excel-sampling-formula-to-SAS-code/m-p/520919#M4122</link>
    <description>&lt;P&gt;The PROBNORM function appears to be what you want. You can map the parameters over by reading the documentation for each function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Excel&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.microsoft.com/en-us/help/827358/excel-statistical-functions-norminv" target="_blank"&gt;https://support.microsoft.com/en-us/help/827358/excel-statistical-functions-norminv&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=p0am6dtkvnrb09n132vioa1z6oen.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;https://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=p0am6dtkvnrb09n132vioa1z6oen.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/250724"&gt;@tpt1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello-&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to convert an Excel formula to SAS code.&amp;nbsp; I do not have experience with statistics, so this is particularly challenging.&amp;nbsp; The Excel formula assumes a confidence&amp;nbsp;interval of 90%, a precision rate of 5%, and an exception rate of 5%.&amp;nbsp; These three&amp;nbsp;values will not change.&amp;nbsp; The only variable is the&amp;nbsp;population size, which I am labeling in the formula as "pop_sz".&amp;nbsp; The pop_sz will always&amp;nbsp;consist of&amp;nbsp;all records in my table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;=IFERROR(CEILING(pop_sz*NORMSINV(0.5+0.5*0.9)^2*0.05*(0.95)/(0.05^2*(pop_sz-1)+NORMSINV(0.5+0.5*0.9)^2*0.05*(0.95)),1),"")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As a pre-step,&amp;nbsp;I can calculate the population size in SAS as:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;sql&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;noprint&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" color="#0000ff"&gt;select&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; count(*) &lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;into&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; :pop_sz&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;from&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; table_a;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&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" color="#0000ff"&gt;%put&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &amp;amp;pop_sz;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;An example using a&amp;nbsp;pop_sz =&amp;nbsp;433 would create a resulting sample size of 47.&amp;nbsp;Could someone provide some guidance on how to convert the Excel code to SAS?&amp;nbsp; Many thanks in advance.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 12 Dec 2018 17:50:47 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-12-12T17:50:47Z</dc:date>
    <item>
      <title>Converting Excel sampling formula to SAS code</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Converting-Excel-sampling-formula-to-SAS-code/m-p/520917#M4121</link>
      <description>&lt;P&gt;Hello-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to convert an Excel formula to SAS code.&amp;nbsp; I do not have experience with statistics, so this is particularly challenging.&amp;nbsp; The Excel formula assumes a confidence&amp;nbsp;interval of 90%, a precision rate of 5%, and an exception rate of 5%.&amp;nbsp; These three&amp;nbsp;values will not change.&amp;nbsp; The only variable is the&amp;nbsp;population size, which I am labeling in the formula as "pop_sz".&amp;nbsp; The pop_sz will always&amp;nbsp;consist of&amp;nbsp;all records in my table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;=IFERROR(CEILING(pop_sz*NORMSINV(0.5+0.5*0.9)^2*0.05*(0.95)/(0.05^2*(pop_sz-1)+NORMSINV(0.5+0.5*0.9)^2*0.05*(0.95)),1),"")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As a pre-step,&amp;nbsp;I can calculate the population size in SAS as:&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;sql&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;noprint&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;select&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; count(*) &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;into&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; :pop_sz&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;from&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; table_a;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&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;%put&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &amp;amp;pop_sz;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;An example using a&amp;nbsp;pop_sz =&amp;nbsp;433 would create a resulting sample size of 47.&amp;nbsp;Could someone provide some guidance on how to convert the Excel code to SAS?&amp;nbsp; Many thanks in advance.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Dec 2018 17:33:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Converting-Excel-sampling-formula-to-SAS-code/m-p/520917#M4121</guid>
      <dc:creator>tpt1</dc:creator>
      <dc:date>2018-12-12T17:33:19Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Excel sampling formula to SAS code</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Converting-Excel-sampling-formula-to-SAS-code/m-p/520919#M4122</link>
      <description>&lt;P&gt;The PROBNORM function appears to be what you want. You can map the parameters over by reading the documentation for each function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Excel&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.microsoft.com/en-us/help/827358/excel-statistical-functions-norminv" target="_blank"&gt;https://support.microsoft.com/en-us/help/827358/excel-statistical-functions-norminv&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=p0am6dtkvnrb09n132vioa1z6oen.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;https://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=p0am6dtkvnrb09n132vioa1z6oen.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/250724"&gt;@tpt1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello-&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to convert an Excel formula to SAS code.&amp;nbsp; I do not have experience with statistics, so this is particularly challenging.&amp;nbsp; The Excel formula assumes a confidence&amp;nbsp;interval of 90%, a precision rate of 5%, and an exception rate of 5%.&amp;nbsp; These three&amp;nbsp;values will not change.&amp;nbsp; The only variable is the&amp;nbsp;population size, which I am labeling in the formula as "pop_sz".&amp;nbsp; The pop_sz will always&amp;nbsp;consist of&amp;nbsp;all records in my table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;=IFERROR(CEILING(pop_sz*NORMSINV(0.5+0.5*0.9)^2*0.05*(0.95)/(0.05^2*(pop_sz-1)+NORMSINV(0.5+0.5*0.9)^2*0.05*(0.95)),1),"")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As a pre-step,&amp;nbsp;I can calculate the population size in SAS as:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;sql&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;noprint&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" color="#0000ff"&gt;select&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; count(*) &lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;into&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; :pop_sz&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;from&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; table_a;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&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" color="#0000ff"&gt;%put&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &amp;amp;pop_sz;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;An example using a&amp;nbsp;pop_sz =&amp;nbsp;433 would create a resulting sample size of 47.&amp;nbsp;Could someone provide some guidance on how to convert the Excel code to SAS?&amp;nbsp; Many thanks in advance.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Dec 2018 17:50:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Converting-Excel-sampling-formula-to-SAS-code/m-p/520919#M4122</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-12-12T17:50:47Z</dc:date>
    </item>
  </channel>
</rss>

