<?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: Calculate Age for Missing Values from DOB in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Calculate-Age-for-Missing-Values-from-DOB/m-p/491317#M128829</link>
    <description>&lt;P&gt;Deleting this for privacy. Thanks RW9 for spotting the error.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 30 Aug 2018 17:22:12 GMT</pubDate>
    <dc:creator>VarunD</dc:creator>
    <dc:date>2018-08-30T17:22:12Z</dc:date>
    <item>
      <title>Calculate Age for Missing Values from DOB</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-Age-for-Missing-Values-from-DOB/m-p/491231#M128771</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to calculate age for Missing values as per the following step and getting syntax error.&amp;nbsp;&lt;/P&gt;&lt;P&gt;What am I doing wrong here :&lt;/P&gt;&lt;P&gt;Varun&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE Employee2 AS&lt;BR /&gt;SELECT DISTINCT t1.Table1,&lt;BR /&gt;variable1,&lt;/P&gt;&lt;P&gt;variable2,&lt;/P&gt;&lt;P&gt;case when&amp;nbsp;variable1 NE . and&amp;nbsp; variable2 LT 18.&lt;BR /&gt;then '17 &amp;amp; Younger'&lt;BR /&gt;case when&amp;nbsp;variable1 NE . and&amp;nbsp;variable2&amp;nbsp;GT 18.&lt;BR /&gt;then '18 &amp;amp; Older'&lt;BR /&gt;case when&amp;nbsp;variable1 EQ .&lt;BR /&gt;then YRDIF(Today(),variable2,'ACT/ACT'))&lt;BR /&gt;else 'Not defined'&lt;BR /&gt;end as Age&lt;/P&gt;&lt;P&gt;else 'Not defined'&lt;BR /&gt;end as Age&lt;/P&gt;&lt;P&gt;FROM Table2 t1&lt;BR /&gt;&lt;BR /&gt;;&lt;BR /&gt;QUIT;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Aug 2018 17:21:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-Age-for-Missing-Values-from-DOB/m-p/491231#M128771</guid>
      <dc:creator>VarunD</dc:creator>
      <dc:date>2018-08-30T17:21:01Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Age for Missing Values from DOB</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-Age-for-Missing-Values-from-DOB/m-p/491257#M128781</link>
      <description>&lt;P&gt;What does the log say, I am going to guess that:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;MBR_DT_OF_BTH&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Is not a numeric date variable,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Aug 2018 14:23:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-Age-for-Missing-Values-from-DOB/m-p/491257#M128781</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-08-30T14:23:04Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Age for Missing Values from DOB</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-Age-for-Missing-Values-from-DOB/m-p/491317#M128829</link>
      <description>&lt;P&gt;Deleting this for privacy. Thanks RW9 for spotting the error.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Aug 2018 17:22:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-Age-for-Missing-Values-from-DOB/m-p/491317#M128829</guid>
      <dc:creator>VarunD</dc:creator>
      <dc:date>2018-08-30T17:22:12Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Age for Missing Values from DOB</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-Age-for-Missing-Values-from-DOB/m-p/491320#M128831</link>
      <description>&lt;P&gt;That shows where you issue is, your case when statement is invalid.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Case statements have two forms:&lt;/P&gt;
&lt;PRE&gt;case when &amp;lt;condition&amp;gt; then &amp;lt;value&amp;gt;
     when &amp;lt;condition&amp;gt; then &amp;lt;value&amp;gt;
     else &amp;lt;value&amp;gt; end&lt;/PRE&gt;
&lt;P&gt;Or:&lt;/P&gt;
&lt;PRE&gt;case &amp;lt;variable&amp;gt; when &amp;lt;condition&amp;gt; then &amp;lt;value&amp;gt;
                when &amp;lt;condition&amp;gt; then &amp;lt;value&amp;gt;
                else &amp;lt;value&amp;gt; end&lt;/PRE&gt;
&lt;P&gt;So:&lt;/P&gt;
&lt;PRE&gt;case when MBR_AGE NE . and MBR_AGE LT 18.
then '17 &amp;amp; Younger'      &amp;lt;--- valid
case when MBR_AGE NE . and MBR_AGE GT 18.
then '18 &amp;amp; Older'           &amp;lt;--- invalid, extra "case"
case when MBR_AGE EQ .
then YRDIF(Today(),MBR_DT_OF_BTH,'ACT/ACT')) &amp;lt;---- invalid extra 'case'
else 'Not defined' &amp;lt;---valid only when above corrected
end as Age

else 'Not defined'   &amp;lt;--- invalid, no case defined.
end as Age&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 Aug 2018 16:09:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-Age-for-Missing-Values-from-DOB/m-p/491320#M128831</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-08-30T16:09:10Z</dc:date>
    </item>
  </channel>
</rss>

