<?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 to create a macro variable which takes date values based on today's date? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-macro-variable-which-takes-date-values-based-on/m-p/736734#M229574</link>
    <description>&lt;P&gt;Simply replace "30APR2021"d with today() for the dynamic transformation.&lt;/P&gt;</description>
    <pubDate>Sat, 24 Apr 2021 10:11:56 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2021-04-24T10:11:56Z</dc:date>
    <item>
      <title>How to create a macro variable which takes date values based on today's date?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-macro-variable-which-takes-date-values-based-on/m-p/736731#M229571</link>
      <description>&lt;P&gt;I want to create two macro variables, one for start date and one for end date, both in date9. format. the start date will be 60 days before today's date and end date will be 7 days before today's date. Suppose, today is 30APR2021, then I can create macros like this:&lt;/P&gt;
&lt;P&gt;%let start_date= 01MAR2021;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;%let end_date= 23APR2021;&lt;/P&gt;
&lt;P&gt;But the problem with this is that I have to run this code on a daily basis which means that each day I will have to change the values of the macro variables. So I want to automatize it in a way that if I am running the code on 01MAY2021 (T) suppose, then the macros will automatically take Start date= 02MAR2021 (T-60) and End date = 24APR2021 (T-7).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there any way to automatize these macros to become dynamic and&amp;nbsp; to take values based on the current date?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 24 Apr 2021 10:00:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-macro-variable-which-takes-date-values-based-on/m-p/736731#M229571</guid>
      <dc:creator>Shradha1</dc:creator>
      <dc:date>2021-04-24T10:00:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a macro variable which takes date values based on today's date?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-macro-variable-which-takes-date-values-based-on/m-p/736733#M229573</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
   call symputx('start_date', put(intnx('day', "30APR2021"d, -60, 's'), date9.));
   call symputx('end_date'  , put(intnx('day', "30APR2021"d, -7, 's'), date9.));
run;

%put &amp;amp;start_date.;
%put &amp;amp;end_date.;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 24 Apr 2021 10:11:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-macro-variable-which-takes-date-values-based-on/m-p/736733#M229573</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-04-24T10:11:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a macro variable which takes date values based on today's date?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-macro-variable-which-takes-date-values-based-on/m-p/736734#M229574</link>
      <description>&lt;P&gt;Simply replace "30APR2021"d with today() for the dynamic transformation.&lt;/P&gt;</description>
      <pubDate>Sat, 24 Apr 2021 10:11:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-macro-variable-which-takes-date-values-based-on/m-p/736734#M229574</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-04-24T10:11:56Z</dc:date>
    </item>
  </channel>
</rss>

