<?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 Character to Numeric - Date conversion in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Character-to-Numeric-Date-conversion/m-p/498376#M132431</link>
    <description>&lt;P&gt;I'm trying to create the numeric variable called PODVER using the following case when in DI Studio. But I'm not sure why I'm getting missing values in PODVER.&amp;nbsp;NEW_RENEWAL_DAY_MONTH_YEAR and CURRENT_DATE are numeric variables and it has values like 20SEP and 20SEP2018 respectively. Please be informed that I'm applying the format DATE9. in the new variable PODVER.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;case when NEW_RENEWAL_DAY_MONTH_YEAR=REPORTING_DATE_ddmon  and KNKATD='7'  then REPORTING_DATE_ddmonyyyy 
         when input(cats(NEW_RENEWAL_DAY_MONTH_YEAR,"2018"),date9.) &amp;gt;CURRENT_DATE then input(cats(NEW_RENEWAL_DAY_MONTH_YEAR,"2018"),date9.) 
         else input(cats(NEW_RENEWAL_DAY_MONTH_YEAR,"2019"),date9.)
end
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Please guide me to resolve the issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 24 Sep 2018 12:48:23 GMT</pubDate>
    <dc:creator>Babloo</dc:creator>
    <dc:date>2018-09-24T12:48:23Z</dc:date>
    <item>
      <title>Character to Numeric - Date conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-to-Numeric-Date-conversion/m-p/498376#M132431</link>
      <description>&lt;P&gt;I'm trying to create the numeric variable called PODVER using the following case when in DI Studio. But I'm not sure why I'm getting missing values in PODVER.&amp;nbsp;NEW_RENEWAL_DAY_MONTH_YEAR and CURRENT_DATE are numeric variables and it has values like 20SEP and 20SEP2018 respectively. Please be informed that I'm applying the format DATE9. in the new variable PODVER.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;case when NEW_RENEWAL_DAY_MONTH_YEAR=REPORTING_DATE_ddmon  and KNKATD='7'  then REPORTING_DATE_ddmonyyyy 
         when input(cats(NEW_RENEWAL_DAY_MONTH_YEAR,"2018"),date9.) &amp;gt;CURRENT_DATE then input(cats(NEW_RENEWAL_DAY_MONTH_YEAR,"2018"),date9.) 
         else input(cats(NEW_RENEWAL_DAY_MONTH_YEAR,"2019"),date9.)
end
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Please guide me to resolve the issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Sep 2018 12:48:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-to-Numeric-Date-conversion/m-p/498376#M132431</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2018-09-24T12:48:23Z</dc:date>
    </item>
    <item>
      <title>Re: Character to Numeric - Date conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-to-Numeric-Date-conversion/m-p/498379#M132432</link>
      <description>&lt;P&gt;Please refer to the guidance on posting a question and review what you post.&amp;nbsp; There are several posts on this topic now.&amp;nbsp; You state that:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;"NEW_RENEWAL_DAY_MONTH_YEAR and CURRENT_DATE are numeric variables and it has values like 20SEP and 20SEP2018"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;A numeric variable cannot contain a text string: "20SEP", in fact a numeric variable (date) also cannot contain 20SEP, although a full numeric date can be formatted to display on day and month.&lt;/P&gt;
&lt;P&gt;Please start by providing us with some text data which accurately shows what your data is and how it looks, particulalrly in a datastep so that we can clearly see formats, types etc.&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unfortunately I cannot debug anything from what you have posted as it all contradicts each other, this for instance:&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;NEW_RENEWAL_DAY_MONTH_YEAR&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;REPORTING_DATE_ddmon&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;How can a day/month/year variable ever be equal to a ddmon variable, and how can a ddmon variable be a date - which can only be all parts-ddmon and yyyy.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Start with test data in the form of a datastep - data which matches what you have for all variables in question.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Sep 2018 12:54:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-to-Numeric-Date-conversion/m-p/498379#M132432</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-09-24T12:54:47Z</dc:date>
    </item>
    <item>
      <title>Re: Character to Numeric - Date conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-to-Numeric-Date-conversion/m-p/498386#M132433</link>
      <description>&lt;P&gt;If your date variables are numeric, then the input(cats(...)) construct won't work as intended. You are not getting any error messages because CATS automatically translates numeric to character, but it does so using the BEST32. format.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What you want to do is probably something like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;case when NEW_RENEWAL_DAY_MONTH_YEAR=REPORTING_DATE_ddmon  and KNKATD='7'  then REPORTING_DATE_ddmonyyyy 
         when mdy(month(NEW_RENEWAL_DAY_MONTH_YEAR),day(&lt;SPAN&gt;NEW_RENEWAL_DAY_MONTH_YEAR&lt;/SPAN&gt;),2018) &amp;gt;CURRENT_DATE then mdy(month(NEW_RENEWAL_DAY_MONTH_YEAR),day(&lt;SPAN&gt;NEW_RENEWAL_DAY_MONTH_YEAR&lt;/SPAN&gt;),2018)
         else mdy(month(NEW_RENEWAL_DAY_MONTH_YEAR),day(&lt;SPAN&gt;NEW_RENEWAL_DAY_MONTH_YEAR)&lt;/SPAN&gt;,2019)
end&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 24 Sep 2018 13:07:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-to-Numeric-Date-conversion/m-p/498386#M132433</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2018-09-24T13:07:36Z</dc:date>
    </item>
  </channel>
</rss>

