<?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 Char to num for DATE in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Char-to-num-for-DATE/m-p/497722#M132024</link>
    <description>&lt;P&gt;I've created the macro variable and it resolves as follows.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;SYMBOLGEN:  Macro variable REPORTING_DATE resolves to 30JUN2018
reporting_date           = 30JUN2018&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Since the macro variable 'reporting_date' is character, I need to convert it to numeric to do comparison with other date variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could someone please guide me?&lt;/P&gt;</description>
    <pubDate>Fri, 21 Sep 2018 08:03:58 GMT</pubDate>
    <dc:creator>Babloo</dc:creator>
    <dc:date>2018-09-21T08:03:58Z</dc:date>
    <item>
      <title>Char to num for DATE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Char-to-num-for-DATE/m-p/497722#M132024</link>
      <description>&lt;P&gt;I've created the macro variable and it resolves as follows.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;SYMBOLGEN:  Macro variable REPORTING_DATE resolves to 30JUN2018
reporting_date           = 30JUN2018&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Since the macro variable 'reporting_date' is character, I need to convert it to numeric to do comparison with other date variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could someone please guide me?&lt;/P&gt;</description>
      <pubDate>Fri, 21 Sep 2018 08:03:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Char-to-num-for-DATE/m-p/497722#M132024</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2018-09-21T08:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: Char to num for DATE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Char-to-num-for-DATE/m-p/497723#M132025</link>
      <description>&lt;P&gt;It can be done several ways, but most direct from what you have is:&lt;/P&gt;
&lt;PRE&gt;%let reporting_date=30JUN2018;

data want;
  set have;
  where date &amp;lt;= "&amp;amp;reporting_date."d;
run;
&lt;/PRE&gt;
&lt;P&gt;You will note here that the text from the macro variable gets put into the quotes, which have a d after - which means for SAS to treat that text as a date literal.&amp;nbsp; You could also say:&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  where date &amp;lt;= input("&amp;amp;reporting_date.",date9.);
run;&lt;/PRE&gt;
&lt;P&gt;Which may be useful if you have formats of date other then date9. - as only date9 works with date literals.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Sep 2018 08:09:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Char-to-num-for-DATE/m-p/497723#M132025</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-09-21T08:09:50Z</dc:date>
    </item>
  </channel>
</rss>

