<?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: How do I convert macro value of MMDDYYYY to work with a SAS Date? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-convert-macro-value-of-MMDDYYYY-to-work-with-a-SAS-Date/m-p/831191#M328449</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/376676"&gt;@StickyRoll&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;have you tried the INPUT function (&lt;A href="https://support.sas.com/publishing/pubcat/chaps/59498.pdf" target="_blank"&gt;Microsoft Word - chap1new.doc (sas.com)&lt;/A&gt;)?&lt;/P&gt;
&lt;P&gt;Best&lt;/P&gt;
&lt;P&gt;Markus&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 31 Aug 2022 04:49:26 GMT</pubDate>
    <dc:creator>MarkusWeick</dc:creator>
    <dc:date>2022-08-31T04:49:26Z</dc:date>
    <item>
      <title>How do I convert macro value of MMDDYYYY to work with a SAS Date?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-convert-macro-value-of-MMDDYYYY-to-work-with-a-SAS-Date/m-p/831190#M328448</link>
      <description>&lt;P&gt;How do I convert macro value of MMDDYYYY to work with a SAS Date?&lt;/P&gt;&lt;P&gt;I have a macro variable that stores value in "MMDDYYYY" format. Eg. 07311999.&lt;/P&gt;&lt;P&gt;I want to find a way to convert this 07311999 macro variable to a SAS Date so that it can work in a normal proc sql or data step.&lt;/P&gt;&lt;P&gt;This is my use case.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;%let mmddyyyy_var = 07311999;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table sasuk as&lt;/P&gt;&lt;P&gt;select *&lt;/P&gt;&lt;P&gt;from work.anything&lt;/P&gt;&lt;P&gt;where creation_date = &amp;amp;mmddyyyy_var.;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;** creation_date is a normal sas date column.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;As we can already tell from the sampel program above, this will not work as&amp;nbsp;&amp;amp;mmddyyyy_var. is in 07311999 format. How can I convert this into a SAS Date for this sql statement to work?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried referring to :&lt;A href="https://go.documentation.sas.com/doc/en/vdmmlcdc/8.1/ds2ref/n03d6ri46spzeln10bt1iepigfdy.htm" target="_blank"&gt;https://go.documentation.sas.com/doc/en/vdmmlcdc/8.1/ds2ref/n03d6ri46spzeln10bt1iepigfdy.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;However, those conversion doesn't work for me in this case.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2022 04:04:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-convert-macro-value-of-MMDDYYYY-to-work-with-a-SAS-Date/m-p/831190#M328448</guid>
      <dc:creator>StickyRoll</dc:creator>
      <dc:date>2022-08-31T04:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert macro value of MMDDYYYY to work with a SAS Date?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-convert-macro-value-of-MMDDYYYY-to-work-with-a-SAS-Date/m-p/831191#M328449</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/376676"&gt;@StickyRoll&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;have you tried the INPUT function (&lt;A href="https://support.sas.com/publishing/pubcat/chaps/59498.pdf" target="_blank"&gt;Microsoft Word - chap1new.doc (sas.com)&lt;/A&gt;)?&lt;/P&gt;
&lt;P&gt;Best&lt;/P&gt;
&lt;P&gt;Markus&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2022 04:49:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-convert-macro-value-of-MMDDYYYY-to-work-with-a-SAS-Date/m-p/831191#M328449</guid>
      <dc:creator>MarkusWeick</dc:creator>
      <dc:date>2022-08-31T04:49:26Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert macro value of MMDDYYYY to work with a SAS Date?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-convert-macro-value-of-MMDDYYYY-to-work-with-a-SAS-Date/m-p/831192#M328450</link>
      <description>&lt;P&gt;Instead of using a macro value in the mmddyyyy format, I'd suggest using the DATE9 format.&amp;nbsp; It's just as readable as your format, but is much easier to parse as a date literal value, as in:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let cutdate=31jul1999;
proc sql;
  create table sasuk as
  select *
  from work.anything
  where creation_date = "&amp;amp;cutdate"d ;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;However, if you must use the mmddyyyy format, then:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let cutdate=07311999;
proc sql;
  create table sasuk as
  select *
  from work.anything
  where creation_date = %sysfunc(inputn(&amp;amp;cutdate,mmddyy8.));
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2022 12:54:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-convert-macro-value-of-MMDDYYYY-to-work-with-a-SAS-Date/m-p/831192#M328450</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2022-08-31T12:54:22Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert macro value of MMDDYYYY to work with a SAS Date?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-convert-macro-value-of-MMDDYYYY-to-work-with-a-SAS-Date/m-p/831194#M328452</link>
      <description>&lt;P&gt;Maxim 28: Macro Variables Need No Format.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let mmddyyyy_var = %sysfunc(inputn(07311999,mmddyy8.));

proc sql;
create table sasuk as
select *
from work.anything
where creation_date = &amp;amp;mmddyyyy_var.;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 31 Aug 2022 05:36:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-convert-macro-value-of-MMDDYYYY-to-work-with-a-SAS-Date/m-p/831194#M328452</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-08-31T05:36:28Z</dc:date>
    </item>
  </channel>
</rss>

