<?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: proc means with some conditions in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-means-with-some-conditions/m-p/242447#M45006</link>
    <description>&lt;P&gt;Thank you very much.&lt;/P&gt;
&lt;P&gt;I used where age &amp;gt;0 and age &amp;lt;100; and it worked.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but when I use where age in (0:100) I had many cases not included. not sure why.&lt;/P&gt;</description>
    <pubDate>Fri, 08 Jan 2016 19:44:49 GMT</pubDate>
    <dc:creator>fengyuwuzu</dc:creator>
    <dc:date>2016-01-08T19:44:49Z</dc:date>
    <item>
      <title>proc means with some conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-means-with-some-conditions/m-p/242436#M45002</link>
      <description>&lt;P&gt;I realized that in my data set the age variables are in the range [-88, +137], so I want to get rid of those unreasable ages.&lt;/P&gt;
&lt;P&gt;I can subset the data set using if condition. But I wonder if there is a way that I can calculate the means, say, in (0,100) range, in the proc means procedure?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And is there a way to count how many cases with age &amp;lt;0 or age &amp;gt;100?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jan 2016 18:44:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-means-with-some-conditions/m-p/242436#M45002</guid>
      <dc:creator>fengyuwuzu</dc:creator>
      <dc:date>2016-01-08T18:44:53Z</dc:date>
    </item>
    <item>
      <title>Re: proc means with some conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-means-with-some-conditions/m-p/242440#M45003</link>
      <description>You can use WHERE statements in almost all procs. &lt;BR /&gt;&lt;BR /&gt;proc means blah blah;&lt;BR /&gt;WHERE age in (0:100);&lt;BR /&gt;...&lt;BR /&gt;run;</description>
      <pubDate>Fri, 08 Jan 2016 18:54:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-means-with-some-conditions/m-p/242440#M45003</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-01-08T18:54:20Z</dc:date>
    </item>
    <item>
      <title>Re: proc means with some conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-means-with-some-conditions/m-p/242446#M45005</link>
      <description>&lt;P&gt;And for the extremes&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc freq data= yourdata;&lt;/P&gt;
&lt;P&gt;where age &amp;lt; 0 or age&amp;gt;100;&lt;/P&gt;
&lt;P&gt;tables age;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jan 2016 19:42:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-means-with-some-conditions/m-p/242446#M45005</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-01-08T19:42:39Z</dc:date>
    </item>
    <item>
      <title>Re: proc means with some conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-means-with-some-conditions/m-p/242447#M45006</link>
      <description>&lt;P&gt;Thank you very much.&lt;/P&gt;
&lt;P&gt;I used where age &amp;gt;0 and age &amp;lt;100; and it worked.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but when I use where age in (0:100) I had many cases not included. not sure why.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jan 2016 19:44:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-means-with-some-conditions/m-p/242447#M45006</guid>
      <dc:creator>fengyuwuzu</dc:creator>
      <dc:date>2016-01-08T19:44:49Z</dc:date>
    </item>
    <item>
      <title>Re: proc means with some conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-means-with-some-conditions/m-p/242452#M45007</link>
      <description>&lt;P&gt;Please note that the notation (0:100) stands for the set of integers {0, 1, 2, ..., 99, 100}. So, for example age=12.3 does not satisfy the condition age in (0:100), although it satisfies 0&amp;lt;age&amp;lt;100.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you sure that all your age values are integers? You could check this with the following step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=yourdata;
where age ne intz(age);
tables age;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If the output of the above PROC FREQ contains any integer value of AGE, then you've encountered a numeric representation issue and you may want to round your AGE values, e.g. like &lt;FONT face="courier new,courier"&gt;age=round(age, 1e-9)&lt;/FONT&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ttt;
age=9.9/3.3; /* should equal 3, mathematically */
run;

proc freq data=ttt;
where age ne intz(age);
tables age; /* looks like 3, but is not 3! */
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jan 2016 20:35:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-means-with-some-conditions/m-p/242452#M45007</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-01-08T20:35:51Z</dc:date>
    </item>
    <item>
      <title>Re: proc means with some conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-means-with-some-conditions/m-p/242467#M45010</link>
      <description>Thank you, you are right. That's why I had many cases excluded in mean calculation.</description>
      <pubDate>Fri, 08 Jan 2016 21:16:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-means-with-some-conditions/m-p/242467#M45010</guid>
      <dc:creator>fengyuwuzu</dc:creator>
      <dc:date>2016-01-08T21:16:47Z</dc:date>
    </item>
  </channel>
</rss>

