<?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: Put date in macro variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Put-date-in-macro-variable/m-p/960435#M374575</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/428110"&gt;@current_thing&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have the following code:&lt;/P&gt;
&lt;PRE&gt;%let dt1=%sysfunc(mdy(1,24,2025));
%put %sysfunc(putn(&amp;amp;dt1,date9.));&lt;/PRE&gt;
&lt;P&gt;%put simply reprints, instead of putting the date. What am I doing wrong? Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't understand what you are trying to do. &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;What result do you want?&lt;/STRONG&gt;&lt;/FONT&gt; What does "putting the date" mean? What will you do with this macro variable once it is created?&lt;/P&gt;</description>
    <pubDate>Thu, 27 Feb 2025 17:49:08 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2025-02-27T17:49:08Z</dc:date>
    <item>
      <title>Put date in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-date-in-macro-variable/m-p/960434#M374574</link>
      <description>&lt;P&gt;I have the following code:&lt;/P&gt;
&lt;PRE&gt;%let dt1=%sysfunc(mdy(1,24,2025));
%put %sysfunc(putn(&amp;amp;dt1,date9.));&lt;/PRE&gt;
&lt;P&gt;%put simply reprints, instead of putting the date. What am I doing wrong? Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2025 17:33:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-date-in-macro-variable/m-p/960434#M374574</guid>
      <dc:creator>current_thing</dc:creator>
      <dc:date>2025-02-27T17:33:48Z</dc:date>
    </item>
    <item>
      <title>Re: Put date in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-date-in-macro-variable/m-p/960435#M374575</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/428110"&gt;@current_thing&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have the following code:&lt;/P&gt;
&lt;PRE&gt;%let dt1=%sysfunc(mdy(1,24,2025));
%put %sysfunc(putn(&amp;amp;dt1,date9.));&lt;/PRE&gt;
&lt;P&gt;%put simply reprints, instead of putting the date. What am I doing wrong? Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't understand what you are trying to do. &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;What result do you want?&lt;/STRONG&gt;&lt;/FONT&gt; What does "putting the date" mean? What will you do with this macro variable once it is created?&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2025 17:49:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-date-in-macro-variable/m-p/960435#M374575</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2025-02-27T17:49:08Z</dc:date>
    </item>
    <item>
      <title>Re: Put date in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-date-in-macro-variable/m-p/960436#M374576</link>
      <description>&lt;P&gt;Your first statement sets a macro variable to a particular date value.&lt;/P&gt;
&lt;P&gt;Your second statement writes the date value in the macro to the SAS log using the PUTN() function to formatted it using the DATE9. format so that a human might recognize what date it is.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What are you trying to do?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2025 17:50:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-date-in-macro-variable/m-p/960436#M374576</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-02-27T17:50:00Z</dc:date>
    </item>
    <item>
      <title>Re: Put date in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-date-in-macro-variable/m-p/960437#M374577</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to put dt1 in a macro variable in date9. format.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2025 17:50:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-date-in-macro-variable/m-p/960437#M374577</guid>
      <dc:creator>current_thing</dc:creator>
      <dc:date>2025-02-27T17:50:14Z</dc:date>
    </item>
    <item>
      <title>Re: Put date in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-date-in-macro-variable/m-p/960438#M374578</link>
      <description>&lt;P&gt;Yes, but the problem is SAS log simply reprints the %put statement, instead of putting the &amp;amp;dt1 in date9. format.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2025 17:51:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-date-in-macro-variable/m-p/960438#M374578</guid>
      <dc:creator>current_thing</dc:creator>
      <dc:date>2025-02-27T17:51:26Z</dc:date>
    </item>
    <item>
      <title>Re: Put date in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-date-in-macro-variable/m-p/960439#M374579</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/428110"&gt;@current_thing&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Yes, but the problem is SAS log simply reprints the %put statement, instead of putting the &amp;amp;dt1 in date9. format.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You are using the same verb to mean many different things which is making you request very hard to understand.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suspect that what you want is for the macro variable named DT1 to have the string produced by the DATE9. format when passed the date 24JAN2025.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could ask %SYSFUNC() to do that for you.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let dt1=%sysfunc(mdy(1,24,2025),date9.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2025 17:56:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-date-in-macro-variable/m-p/960439#M374579</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-02-27T17:56:24Z</dc:date>
    </item>
    <item>
      <title>Re: Put date in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-date-in-macro-variable/m-p/960440#M374580</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let dt1=%sysfunc(mdy(1,24,2025));
%let dt1=%sysfunc(putn(&amp;amp;dt1,date9.));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which brings me back to my earlier question ... what are you going to do with this macro variable once you have created it properly? There are times when having a macro variable with a value of 24JAN2025 isn't useful.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2025 17:56:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-date-in-macro-variable/m-p/960440#M374580</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2025-02-27T17:56:33Z</dc:date>
    </item>
    <item>
      <title>Re: Put date in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-date-in-macro-variable/m-p/960441#M374581</link>
      <description>&lt;P&gt;I tried it, and I get 'quoted string currently being processed has become more than 262 characters long' in SAS log&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2025 17:57:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-date-in-macro-variable/m-p/960441#M374581</guid>
      <dc:creator>current_thing</dc:creator>
      <dc:date>2025-02-27T17:57:13Z</dc:date>
    </item>
    <item>
      <title>Re: Put date in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-date-in-macro-variable/m-p/960442#M374582</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/428110"&gt;@current_thing&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I tried it, and I get 'quoted string currently being processed has become more than 262 characters long' in SAS log&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;which means that somewhere earlier in your program, you have an unclosed quote&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and you might be better off shutting down SAS, restarting it, and the problem should go away.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2025 17:59:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-date-in-macro-variable/m-p/960442#M374582</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2025-02-27T17:59:35Z</dc:date>
    </item>
    <item>
      <title>Re: Put date in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-date-in-macro-variable/m-p/960443#M374583</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/428110"&gt;@current_thing&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I tried it, and I get 'quoted string currently being processed has become more than 262 characters long' in SAS log&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That is because you have unbalanced quotes in some code that you have submitted.&amp;nbsp; There are things you can try to submit to balance the quotes.&amp;nbsp; But I usually find it faster to just restart the SAS session and try again.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2025 18:00:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-date-in-macro-variable/m-p/960443#M374583</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-02-27T18:00:04Z</dc:date>
    </item>
    <item>
      <title>Re: Put date in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-date-in-macro-variable/m-p/960444#M374584</link>
      <description>&lt;P&gt;restart SAS worked! Thank you Tom&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2025 18:02:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-date-in-macro-variable/m-p/960444#M374584</guid>
      <dc:creator>current_thing</dc:creator>
      <dc:date>2025-02-27T18:02:40Z</dc:date>
    </item>
  </channel>
</rss>

