<?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 not working? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-date-not-working/m-p/833106#M329325</link>
    <description>&lt;P&gt;Great point from&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15475"&gt;@andreas_lds&lt;/a&gt;&amp;nbsp;. To&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt;&amp;nbsp;you should never need to pull apart text strings to work with SAS dates; there are plenty of built-in functions/formats/informats that you can use to avoid the need to pull apart text strings. SAS has done the hard work regarding handling dates, so you don't have to.&lt;/P&gt;</description>
    <pubDate>Tue, 13 Sep 2022 12:46:35 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2022-09-13T12:46:35Z</dc:date>
    <item>
      <title>Macro date not working?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-date-not-working/m-p/832934#M329262</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I would like to use the current date to generate an output file.&amp;nbsp; However, I don't see the output date in my export file name.&amp;nbsp; I continue getting a '&amp;amp;tdate.' in the end.&amp;nbsp; Where did I do wrong?&amp;nbsp; Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
	call symput('tdate',put(year("&amp;amp;sysdate"d),4.)||'_'||put(month("&amp;amp;sysdate"d),z2.)||'_'||put(day("&amp;amp;sysdate"d),z2.));
run;

%put &amp;amp;tdate;

ods rtf file = 'Pathwat\AUD1619_RTY_Clinic_&amp;amp;tdate..rtf';

ods rtf close;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Sep 2022 16:28:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-date-not-working/m-p/832934#M329262</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2022-09-12T16:28:05Z</dc:date>
    </item>
    <item>
      <title>Re: Macro date not working?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-date-not-working/m-p/832948#M329268</link>
      <description>&lt;P&gt;Macros do not resolve within single quotes see &lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/mcrolref/n0700fspmubii5n1vecutttwz93n.htm&amp;nbsp;" target="_self"&gt;Using Macro Variables&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;After a macro variable is created, you typically use the variable by referencing it with an ampersand preceding its name (&amp;amp;&lt;/SPAN&gt;&lt;EM class="xisDoc-userSuppliedValue"&gt;variable-name&lt;/EM&gt;&lt;SPAN&gt;), which is called a&amp;nbsp;&lt;/SPAN&gt;&lt;EM class="xisDoc-definedTerm"&gt;macro variable reference&lt;/EM&gt;&lt;SPAN&gt;. These references perform symbolic substitutions when they resolve to their value. You can use these references anywhere in a SAS program. &lt;FONT color="#FF0000"&gt;To resolve a macro variable reference that occurs within a literal string, enclose the string in double quotation marks. Macro variable references that are enclosed in single quotation marks are not resolved.&lt;/FONT&gt; Compare the following statements that assign a value to macro variable DSN and use it in a TITLE statement:&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Sep 2022 17:16:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-date-not-working/m-p/832948#M329268</guid>
      <dc:creator>AMSAS</dc:creator>
      <dc:date>2022-09-12T17:16:23Z</dc:date>
    </item>
    <item>
      <title>Re: Macro date not working?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-date-not-working/m-p/832950#M329269</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is not working because the rtf filename is in single quotes. Then the macro variable reference is treated as a constant.&lt;/P&gt;
&lt;P&gt;Use double quotes instead.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Sep 2022 17:15:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-date-not-working/m-p/832950#M329269</guid>
      <dc:creator>ErikLund_Jensen</dc:creator>
      <dc:date>2022-09-12T17:15:01Z</dc:date>
    </item>
    <item>
      <title>Re: Macro date not working?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-date-not-working/m-p/833089#M329317</link>
      <description>&lt;P&gt;You can simplify the creation of the date variable by using put with format yymmddn8:&lt;/P&gt;
&lt;PRE&gt;30         data _null_;
31            call symputx('tdate', put("&amp;amp;sysdate."d, yymmddn8.));
32         run;
33         
34         %put &amp;amp;=tdate;
TDATE=20220913&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Sep 2022 11:59:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-date-not-working/m-p/833089#M329317</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-09-13T11:59:21Z</dc:date>
    </item>
    <item>
      <title>Re: Macro date not working?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-date-not-working/m-p/833106#M329325</link>
      <description>&lt;P&gt;Great point from&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15475"&gt;@andreas_lds&lt;/a&gt;&amp;nbsp;. To&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt;&amp;nbsp;you should never need to pull apart text strings to work with SAS dates; there are plenty of built-in functions/formats/informats that you can use to avoid the need to pull apart text strings. SAS has done the hard work regarding handling dates, so you don't have to.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2022 12:46:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-date-not-working/m-p/833106#M329325</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-09-13T12:46:35Z</dc:date>
    </item>
  </channel>
</rss>

