<?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: Not applicable variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Not-applicable-variable/m-p/416033#M102138</link>
    <description>&lt;P&gt;If the 999 gets excluded entirely from numerator and denominator then use a WHERE.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Where not missing(var);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 24 Nov 2017 14:33:40 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-11-24T14:33:40Z</dc:date>
    <item>
      <title>Not applicable variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Not-applicable-variable/m-p/416026#M102134</link>
      <description>&lt;P&gt;Hi all! I've a question about a variable when it is not applicable. In my dataset there is a variable for diabetes. Persons with diabetes get a 1 and persons without get a 0. There is also a variable which contains the age of diabetes diagnosis. So only for the diabetes=1 persons there is an age in the diabetes diagnosis variable. The others with a diabetes=0, I give a '999' as in not applicable in the diabetes age variable. The real missings get a dot. But now for calculating the mean age of diabetes diagnosis, SAS takes also the 999 into account. What could I do to take only the 'real' diabetes ages into account in the mean statement and not the 999 values? So that it is treated in the same way as the real missing values with a dot? I want to do this in the MEAN statement and NOT working with IF diabetes=1 THEN .. as it is possible.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 24 Nov 2017 14:10:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Not-applicable-variable/m-p/416026#M102134</guid>
      <dc:creator>hovliza</dc:creator>
      <dc:date>2017-11-24T14:10:27Z</dc:date>
    </item>
    <item>
      <title>Re: Not applicable variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Not-applicable-variable/m-p/416028#M102135</link>
      <description>&lt;P&gt;What does your code look like now?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A simple where statement may solve your problem.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Nov 2017 14:35:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Not-applicable-variable/m-p/416028#M102135</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-11-24T14:35:14Z</dc:date>
    </item>
    <item>
      <title>Re: Not applicable variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Not-applicable-variable/m-p/416032#M102137</link>
      <description>&lt;P&gt;Instead of using 999 to indicate not applicable, you would be better off using a special missing value.&amp;nbsp; For example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if var = 999 then var = .N ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That way, you can distinguish .N from . and yet PROC MEANS knows enough to throw both values out of the calculations.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Nov 2017 14:29:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Not-applicable-variable/m-p/416032#M102137</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-11-24T14:29:53Z</dc:date>
    </item>
    <item>
      <title>Re: Not applicable variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Not-applicable-variable/m-p/416033#M102138</link>
      <description>&lt;P&gt;If the 999 gets excluded entirely from numerator and denominator then use a WHERE.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Where not missing(var);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Nov 2017 14:33:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Not-applicable-variable/m-p/416033#M102138</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-11-24T14:33:40Z</dc:date>
    </item>
    <item>
      <title>Re: Not applicable variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Not-applicable-variable/m-p/416036#M102139</link>
      <description>&lt;P&gt;Okay, I tried this. But then the values of .N are also counted as missing values in PROC MEANS NMISS statement. What can I do to let PROC MEANS know that this is not a 'missing value' and that it also not is taken into acount in the calculations?&lt;/P&gt;</description>
      <pubDate>Fri, 24 Nov 2017 15:00:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Not-applicable-variable/m-p/416036#M102139</guid>
      <dc:creator>hovliza</dc:creator>
      <dc:date>2017-11-24T15:00:47Z</dc:date>
    </item>
    <item>
      <title>Re: Not applicable variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Not-applicable-variable/m-p/416038#M102140</link>
      <description>&lt;P&gt;PROC MEANS can't do that.&amp;nbsp; A value is either missing (and excluded from calculations) or not missing (and included in calculations).&amp;nbsp; There are no other choices as far as PROC MEANS is concerned.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want separate counts, you could use PROC FREQ.&amp;nbsp; For example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc format;&lt;/P&gt;
&lt;P&gt;value valid low-high='Valid';&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;proc freq data=have;&lt;/P&gt;
&lt;P&gt;tables var / missing;&lt;/P&gt;
&lt;P&gt;format var valid.;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Be sure to include the MISSING option to get separate counts for each type of missing value.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Nov 2017 15:05:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Not-applicable-variable/m-p/416038#M102140</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-11-24T15:05:06Z</dc:date>
    </item>
    <item>
      <title>Re: Not applicable variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Not-applicable-variable/m-p/416061#M102142</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another way by using proc sql:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sql;&lt;BR /&gt;select diabetes,mean(age) as mean_age&lt;BR /&gt;from have&lt;BR /&gt;group by diabetes;&lt;BR /&gt;quit;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Nov 2017 17:08:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Not-applicable-variable/m-p/416061#M102142</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2017-11-24T17:08:41Z</dc:date>
    </item>
  </channel>
</rss>

