<?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: Macro Date could not be recognized? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-Date-could-not-be-recognized/m-p/849760#M335909</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I don't want the computer system date. I would like to change bdate '2022_12_12' to bdate1 '12DEC2022' format. How?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Do you have an example of some code you need to use the macro to generate where you need to have that string?&lt;/P&gt;
&lt;P&gt;The example you posted is comparing to a DATE variable. That will not work with a string like '12DEC2022'.&amp;nbsp; For that you need to use an actual date value.&amp;nbsp; So either the actual date value (such as 22991) or a date literal (such as "12DEC2022"d).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;516  %put %sysevalf("12DEC2022"d);
22991
&lt;/PRE&gt;</description>
    <pubDate>Thu, 15 Dec 2022 00:40:22 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2022-12-15T00:40:22Z</dc:date>
    <item>
      <title>Macro Date could not be recognized?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Date-could-not-be-recognized/m-p/849721#M335894</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I found an error message when I ran a macro.&amp;nbsp; Please see the details below.&amp;nbsp; I won't be able to list the entire messages below.&amp;nbsp; There are a thousand lines.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let bdate=2022_12_12;

proc sql;
create table cov&amp;amp;rr as
select site, date, id, ageyears, agemonths, 
       source, &amp;amp;regprodate1 
from CoV
where 
      (&amp;amp;regprodate1&amp;gt;"&amp;amp;bdate."d and &amp;amp;regprodate1 ^= '08aug8888'd) 
order by site,id;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;ERROR: Invalid date/time/datetime constant "2022_12_12"d.&lt;BR /&gt;(covprovdt2&amp;gt;"2022_12_12"d and covprovdt2 ^= '08aug8888'd)&lt;BR /&gt;&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;/PRE&gt;
&lt;P&gt;I think the date format could not be recognized by SAS.&amp;nbsp; Do I have to create a new specific one shown below?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let bdate1=12DEC2022;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The old one, 'bdate', needs to be used somewhere else.&amp;nbsp; Could I keep the old one, 'bdate', and make some modifications in the where command? Just curious.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2022 19:29:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Date-could-not-be-recognized/m-p/849721#M335894</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2022-12-14T19:29:23Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Date could not be recognized?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Date-could-not-be-recognized/m-p/849723#M335895</link>
      <description>&lt;PRE&gt;ERROR: Invalid date/time/datetime constant "2022_12_12"d.&lt;/PRE&gt;
&lt;P&gt;Must be in the form "12DEC2022"d (and not in any other form of representing dates)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you want:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let bdate=12DEC2022;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2022 19:40:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Date-could-not-be-recognized/m-p/849723#M335895</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-12-14T19:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Date could not be recognized?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Date-could-not-be-recognized/m-p/849724#M335896</link>
      <description>&lt;P&gt;A date literal,&amp;nbsp; a quoted string followed by the letter d,&amp;nbsp; needs to use a string that the DATE informat can recognize as a date.&lt;/P&gt;
&lt;P&gt;It you need to use the date in two different ways go ahead and make another macro variable that has the actual date.&amp;nbsp; Note that it does not have to be formatted in a way that a human would understand it.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let bdate=2022_12_12;
%let bdate_actual = %sysfunc(inputn(&amp;amp;bdate,yymmdd10.));

proc sql;
create table cov&amp;amp;rr as
select site, date, id, ageyears
    , agemonths
    , source, &amp;amp;regprodate1 
from CoV
where 
      (&amp;amp;regprodate1&amp;gt;&amp;amp;bdate_actual and &amp;amp;regprodate1 ^= '08aug8888'd) 
order by site,id
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2022 19:51:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Date-could-not-be-recognized/m-p/849724#M335896</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-12-14T19:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Date could not be recognized?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Date-could-not-be-recognized/m-p/849759#M335908</link>
      <description>I don't want the computer system date.  I would like to change bdate '2022_12_12' to bdate1 '12DEC2022' format.  How?</description>
      <pubDate>Thu, 15 Dec 2022 00:28:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Date-could-not-be-recognized/m-p/849759#M335908</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2022-12-15T00:28:20Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Date could not be recognized?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Date-could-not-be-recognized/m-p/849760#M335909</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I don't want the computer system date. I would like to change bdate '2022_12_12' to bdate1 '12DEC2022' format. How?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Do you have an example of some code you need to use the macro to generate where you need to have that string?&lt;/P&gt;
&lt;P&gt;The example you posted is comparing to a DATE variable. That will not work with a string like '12DEC2022'.&amp;nbsp; For that you need to use an actual date value.&amp;nbsp; So either the actual date value (such as 22991) or a date literal (such as "12DEC2022"d).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;516  %put %sysevalf("12DEC2022"d);
22991
&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Dec 2022 00:40:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Date-could-not-be-recognized/m-p/849760#M335909</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-12-15T00:40:22Z</dc:date>
    </item>
  </channel>
</rss>

