<?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: Taking Dates Dynamically in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Taking-Dates-Dynamically/m-p/689893#M209772</link>
    <description>&lt;P&gt;I SERIOUSLY doubt that your code works, unless you have "dates" stored in a most unusable fashion. December 1st, 2019 must be written as "01dec2019"d to be a SAS date value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Having said that, here's code that shows how to derive your dates from a given year:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let year=2020;

data _null_;
call symputx("prevcut",mdy(12,1,&amp;amp;year. - 1));
call symputx("currcut",mdy(12,1,&amp;amp;year.));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;which you can then use to compare with dates stored in a dataset:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Previous_Date &amp;gt; &amp;amp;prevcut. and Current_Date &amp;lt; &amp;amp;currcut.&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 08 Oct 2020 08:08:42 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2020-10-08T08:08:42Z</dc:date>
    <item>
      <title>Taking Dates Dynamically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Taking-Dates-Dynamically/m-p/689888#M209768</link>
      <description>&lt;P&gt;Currently i am fetching data based on below date filter manually.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Previous_Date&amp;gt;20191201 and Current_Date&amp;lt;20201201&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want take above date dynamically using macro.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then next year it should be&amp;nbsp;Previous_Date&amp;gt;20201201&amp;nbsp;and Current_Date&amp;lt;20211201 and it should go on for every year&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2020 07:56:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Taking-Dates-Dynamically/m-p/689888#M209768</guid>
      <dc:creator>Son_Of_Krypton</dc:creator>
      <dc:date>2020-10-08T07:56:03Z</dc:date>
    </item>
    <item>
      <title>Re: Taking Dates Dynamically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Taking-Dates-Dynamically/m-p/689893#M209772</link>
      <description>&lt;P&gt;I SERIOUSLY doubt that your code works, unless you have "dates" stored in a most unusable fashion. December 1st, 2019 must be written as "01dec2019"d to be a SAS date value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Having said that, here's code that shows how to derive your dates from a given year:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let year=2020;

data _null_;
call symputx("prevcut",mdy(12,1,&amp;amp;year. - 1));
call symputx("currcut",mdy(12,1,&amp;amp;year.));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;which you can then use to compare with dates stored in a dataset:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Previous_Date &amp;gt; &amp;amp;prevcut. and Current_Date &amp;lt; &amp;amp;currcut.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Oct 2020 08:08:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Taking-Dates-Dynamically/m-p/689893#M209772</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-10-08T08:08:42Z</dc:date>
    </item>
    <item>
      <title>Re: Taking Dates Dynamically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Taking-Dates-Dynamically/m-p/689907#M209780</link>
      <description>I don't want to use %let statement it should pick up the year from dataset and should increase by year when it will start running for next year</description>
      <pubDate>Thu, 08 Oct 2020 09:22:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Taking-Dates-Dynamically/m-p/689907#M209780</guid>
      <dc:creator>Son_Of_Krypton</dc:creator>
      <dc:date>2020-10-08T09:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: Taking Dates Dynamically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Taking-Dates-Dynamically/m-p/689910#M209783</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/190967"&gt;@Son_Of_Krypton&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I don't want to use %let statement it should pick up the year from dataset and should increase by year when it will start running for next year&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Is the year in a variable within the dataset, or is it part of the dataset name? If the latter, are those dataset names structured consistently, and how?&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2020 09:44:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Taking-Dates-Dynamically/m-p/689910#M209783</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-10-08T09:44:03Z</dc:date>
    </item>
  </channel>
</rss>

