<?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: SAS Dates in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Dates/m-p/656236#M196770</link>
    <description>&lt;P&gt;In short: no.&lt;/P&gt;
&lt;P&gt;The longer answer: today() is what it is: today. &lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Jan.&lt;/P&gt;</description>
    <pubDate>Wed, 10 Jun 2020 08:46:34 GMT</pubDate>
    <dc:creator>jklaverstijn</dc:creator>
    <dc:date>2020-06-10T08:46:34Z</dc:date>
    <item>
      <title>SAS Dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Dates/m-p/655989#M196750</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using date functions like today(), intnx etc. in my code.&lt;/P&gt;&lt;P&gt;Is there any way to point SAS date to yesterday at starting of the session ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;call symput('run_dt', put(today(),yymmddn8.));&amp;nbsp; --&amp;gt;As per exisiting logic, this will return today's date.&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any way to define SAS date prior to the above step, so by default it will point to yesterday's date ?&lt;/P&gt;&lt;P&gt;Note - I don't want to use today()-1&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please share your thoughts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 06:22:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Dates/m-p/655989#M196750</guid>
      <dc:creator>AshokD</dc:creator>
      <dc:date>2020-06-10T06:22:07Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Dates/m-p/656001#M196752</link>
      <description>You already know the best way ... today()-1.  If you want a more complex way to help preserve job security, you can use:&lt;BR /&gt;&lt;BR /&gt;intnx("day", today(), -1)</description>
      <pubDate>Wed, 10 Jun 2020 06:29:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Dates/m-p/656001#M196752</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2020-06-10T06:29:36Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Dates/m-p/656152#M196760</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/56202"&gt;@AshokD&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Would you like to identify the day before today or the day before the opening of the SAS session?&lt;/P&gt;
&lt;P&gt;It can be quite different.&amp;nbsp;In the last case, it would be better to use &amp;amp;sysdate rather than today().&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 08:05:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Dates/m-p/656152#M196760</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-06-10T08:05:51Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Dates/m-p/656186#M196763</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code has about 2k+ lines , they have used today() functions in so many places in the code. For some reason I need to run the job to pull data as of yesterday. Instead of changing the code today()-1 in all the places, is there any way to define current date as yesterday at the starting of the code so that today() function resolves to yesterday in all the logics placed in the code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any possibility ?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 08:15:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Dates/m-p/656186#M196763</guid>
      <dc:creator>AshokD</dc:creator>
      <dc:date>2020-06-10T08:15:23Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Dates/m-p/656236#M196770</link>
      <description>&lt;P&gt;In short: no.&lt;/P&gt;
&lt;P&gt;The longer answer: today() is what it is: today. &lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Jan.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 08:46:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Dates/m-p/656236#M196770</guid>
      <dc:creator>jklaverstijn</dc:creator>
      <dc:date>2020-06-10T08:46:34Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Dates/m-p/656239#M196772</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/56202"&gt;@AshokD&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My code has about 2k+ lines , they have used today() functions in so many places in the code. For some reason I need to run the job to pull data as of yesterday. Instead of changing the code today()-1 in all the places, is there any way to define current date as yesterday at the starting of the code so that today() function resolves to yesterday in all the logics placed in the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there any possibility ?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;No, unless you reset the SAS server's system clock.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do a search and replace in your code, and replace every occurence of today() with&lt;/P&gt;
&lt;PRE&gt;&amp;amp;todays_date.&lt;/PRE&gt;
&lt;P&gt;At the beginning of your code, insert&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let todays_date=%eval(%sysfunc(today()) - 1);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now you only need to change this line in the future.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 08:48:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Dates/m-p/656239#M196772</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-06-10T08:48:02Z</dc:date>
    </item>
  </channel>
</rss>

