<?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: Need help fixing my code, the errors are not making sense to me. in SAS Software for Learning Community</title>
    <link>https://communities.sas.com/t5/SAS-Software-for-Learning/Need-help-fixing-my-code-the-errors-are-not-making-sense-to-me/m-p/924123#M1847</link>
    <description>&lt;P&gt;With &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/284679"&gt;@JackieJ_SAS&lt;/a&gt;'s comment, perhaps you want the SAMPRATE , as in a percentage of observations, instead of SAMPSIZE, a specific number of observations?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: &lt;STRONG&gt;any time&lt;/STRONG&gt; you get errors best practice on this forum is to copy the LOG text with the submitted code and all notes, messages, warnings or errors. Then on the forum open a text box and paste the copied log text.&lt;/P&gt;
&lt;P&gt;The text box will preserve the text layout and position of diagnostic information SAS often supplies in error messages as the main message windows will reformat pasted text reducing the usefulness of the text somewhat.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also the complete log text is important. We often have people ask about an "error" that is not indeed an error but a warning or sometimes just information.&lt;/P&gt;</description>
    <pubDate>Fri, 12 Apr 2024 13:55:31 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2024-04-12T13:55:31Z</dc:date>
    <item>
      <title>Need help fixing my code, the errors are not making sense to me.</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/Need-help-fixing-my-code-the-errors-are-not-making-sense-to-me/m-p/924036#M1843</link>
      <description>&lt;P&gt;So I'm trying to create a sample using SAS. I'm using a Sample Size formula defined below. But I get errors saying that the Eval has characters instead of numbers but I dont think it's true, also one of the other errors are in my options for the proc Surveyselect it says they don't belong? but I think they do, based on the Proc Surveyselect resources. any help would be appreciated.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the Code, I'm using the Pg2 library from the 2nd lesson:&lt;/P&gt;&lt;P&gt;%let Z = 1.96;&lt;BR /&gt;%let P = 0.05;&lt;BR /&gt;%let E = 0.05;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;BR /&gt;select count(*) into :N from pg2.class_birthdate;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;%let Sample_Size = %eval((&amp;amp;N * ((&amp;amp;E * (1 - &amp;amp;E)) / (&amp;amp;P / &amp;amp;Z) ** 2)) / (((&amp;amp;E * (1 - &amp;amp;E)) / ((&amp;amp;P / &amp;amp;Z) ** 2)) + &amp;amp;N - 1));&lt;/P&gt;&lt;P&gt;%put Sample Size: &amp;amp;Sample_Size;&lt;/P&gt;&lt;P&gt;data SampledClass;&lt;BR /&gt;proc surveyselect data=pg2.class_birthdate&lt;BR /&gt;method=srs&lt;BR /&gt;out=SampledClass&lt;BR /&gt;sampsize= &amp;amp;sample_size&lt;BR /&gt;seed=1234;&lt;BR /&gt;run;&lt;BR /&gt;proc print data=SampledClass;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2024 21:53:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/Need-help-fixing-my-code-the-errors-are-not-making-sense-to-me/m-p/924036#M1843</guid>
      <dc:creator>Mluna</dc:creator>
      <dc:date>2024-04-11T21:53:05Z</dc:date>
    </item>
    <item>
      <title>Re: Need help fixing my code, the errors are not making sense to me.</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/Need-help-fixing-my-code-the-errors-are-not-making-sense-to-me/m-p/924084#M1844</link>
      <description>&lt;P&gt;Try using the %SYSEVALF macro function instead of the %EVAL macro function in your statement beginning with %LET SAMPLE_SIZE. The %EVAL function works only with integer values and will throw an error if you give it an argument that includes decimal point characters. The %SYSEVALF function does floating point arithmetic, so works with numbers with decimal points. See the SAS documentation for more information:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/mcrolref/n07pr39df9k7m3n1w3x1q09iewta.htm" target="_blank"&gt;SAS Help Center: %EVAL&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/mcrolref/p1d9ypna2tpt16n1xam57kuffcpt.htm" target="_blank"&gt;SAS Help Center: %SYSEVALF&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2024 11:35:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/Need-help-fixing-my-code-the-errors-are-not-making-sense-to-me/m-p/924084#M1844</guid>
      <dc:creator>JackieJ_SAS</dc:creator>
      <dc:date>2024-04-12T11:35:36Z</dc:date>
    </item>
    <item>
      <title>Re: Need help fixing my code, the errors are not making sense to me.</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/Need-help-fixing-my-code-the-errors-are-not-making-sense-to-me/m-p/924085#M1845</link>
      <description>&lt;P&gt;Additionally, I see your problem with the PROC SURVEYSELECT code. The formula in your %LET SAMPLE_SIZE statement resolves to a non-integer. (I get &lt;SPAN&gt;15.2413617261025&lt;/SPAN&gt;&lt;SPAN&gt;). The SAMPSIZE= option on the PROC SURVEYSELECT statement requires an integer, so throws an error when you provide a non-integer.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2024 13:30:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/Need-help-fixing-my-code-the-errors-are-not-making-sense-to-me/m-p/924085#M1845</guid>
      <dc:creator>JackieJ_SAS</dc:creator>
      <dc:date>2024-04-12T13:30:32Z</dc:date>
    </item>
    <item>
      <title>Re: Need help fixing my code, the errors are not making sense to me.</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/Need-help-fixing-my-code-the-errors-are-not-making-sense-to-me/m-p/924096#M1846</link>
      <description>&lt;P&gt;In which case it might be better to use %SYSFUNC(CEIL()) instead of %SYSEVALF().&lt;/P&gt;
&lt;PRE&gt;%let Z = 1.96;
%let P = 0.05;
%let E = 0.05;
%let N=12345 ;

%let Sample_Size=%sysfunc(ceil((&amp;amp;N * ((&amp;amp;E * (1 - &amp;amp;E)) / (&amp;amp;P / &amp;amp;Z) ** 2)) / (((&amp;amp;E * (1 - &amp;amp;E)) / ((&amp;amp;P / &amp;amp;Z) ** 2)) + &amp;amp;N - 1)));

%put Sample Size: &amp;amp;Sample_Size;&lt;/PRE&gt;
&lt;P&gt;Result&lt;/P&gt;
&lt;PRE&gt;1590  %put Sample Size: &amp;amp;Sample_Size;
Sample Size: 73

&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 Apr 2024 12:57:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/Need-help-fixing-my-code-the-errors-are-not-making-sense-to-me/m-p/924096#M1846</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-04-12T12:57:55Z</dc:date>
    </item>
    <item>
      <title>Re: Need help fixing my code, the errors are not making sense to me.</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/Need-help-fixing-my-code-the-errors-are-not-making-sense-to-me/m-p/924123#M1847</link>
      <description>&lt;P&gt;With &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/284679"&gt;@JackieJ_SAS&lt;/a&gt;'s comment, perhaps you want the SAMPRATE , as in a percentage of observations, instead of SAMPSIZE, a specific number of observations?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: &lt;STRONG&gt;any time&lt;/STRONG&gt; you get errors best practice on this forum is to copy the LOG text with the submitted code and all notes, messages, warnings or errors. Then on the forum open a text box and paste the copied log text.&lt;/P&gt;
&lt;P&gt;The text box will preserve the text layout and position of diagnostic information SAS often supplies in error messages as the main message windows will reformat pasted text reducing the usefulness of the text somewhat.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also the complete log text is important. We often have people ask about an "error" that is not indeed an error but a warning or sometimes just information.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2024 13:55:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/Need-help-fixing-my-code-the-errors-are-not-making-sense-to-me/m-p/924123#M1847</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-04-12T13:55:31Z</dc:date>
    </item>
    <item>
      <title>Re: Need help fixing my code, the errors are not making sense to me.</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/Need-help-fixing-my-code-the-errors-are-not-making-sense-to-me/m-p/924140#M1848</link>
      <description>Thank you! I'm silly I knew they had to be integers, I knew i was supposed to round the answer because that's how i currently do it in excel.</description>
      <pubDate>Fri, 12 Apr 2024 15:05:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/Need-help-fixing-my-code-the-errors-are-not-making-sense-to-me/m-p/924140#M1848</guid>
      <dc:creator>Mluna</dc:creator>
      <dc:date>2024-04-12T15:05:12Z</dc:date>
    </item>
    <item>
      <title>Re: Need help fixing my code, the errors are not making sense to me.</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/Need-help-fixing-my-code-the-errors-are-not-making-sense-to-me/m-p/924141#M1849</link>
      <description>Thank you! I knew I was supposed to round it. I'm just very forgetful.</description>
      <pubDate>Fri, 12 Apr 2024 15:05:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/Need-help-fixing-my-code-the-errors-are-not-making-sense-to-me/m-p/924141#M1849</guid>
      <dc:creator>Mluna</dc:creator>
      <dc:date>2024-04-12T15:05:53Z</dc:date>
    </item>
    <item>
      <title>Re: Need help fixing my code, the errors are not making sense to me.</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/Need-help-fixing-my-code-the-errors-are-not-making-sense-to-me/m-p/924142#M1850</link>
      <description>Thank you for the tip! I'll follow this to include the log next time!. The formula evaluates to a specific number so Sampsize is what i wanted to use. It was just me forgetting to round the number back to a whole integer.</description>
      <pubDate>Fri, 12 Apr 2024 15:06:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/Need-help-fixing-my-code-the-errors-are-not-making-sense-to-me/m-p/924142#M1850</guid>
      <dc:creator>Mluna</dc:creator>
      <dc:date>2024-04-12T15:06:56Z</dc:date>
    </item>
  </channel>
</rss>

