<?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: Over write sysdate value in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Over-write-sysdate-value/m-p/685743#M37065</link>
    <description>&lt;P&gt;&amp;amp;sysdate is read only. You can't modify it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use a different name, and that should work&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let sysdate1 = %eval(%sysfunc(today())-4);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 22 Sep 2020 15:58:02 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2020-09-22T15:58:02Z</dc:date>
    <item>
      <title>Over write sysdate value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Over-write-sysdate-value/m-p/685742#M37064</link>
      <description>I want to change the date in sysdate for some automation like&lt;BR /&gt;%let sysdate = today()-4;&lt;BR /&gt;This is not working please help me solve this.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 22 Sep 2020 15:51:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Over-write-sysdate-value/m-p/685742#M37064</guid>
      <dc:creator>Rajeshganta</dc:creator>
      <dc:date>2020-09-22T15:51:33Z</dc:date>
    </item>
    <item>
      <title>Re: Over write sysdate value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Over-write-sysdate-value/m-p/685743#M37065</link>
      <description>&lt;P&gt;&amp;amp;sysdate is read only. You can't modify it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use a different name, and that should work&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let sysdate1 = %eval(%sysfunc(today())-4);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 Sep 2020 15:58:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Over-write-sysdate-value/m-p/685743#M37065</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-09-22T15:58:02Z</dc:date>
    </item>
    <item>
      <title>Re: Over write sysdate value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Over-write-sysdate-value/m-p/685745#M37066</link>
      <description>&lt;P&gt;I don't think you can do that (and you really shouldn't even if you could).&lt;/P&gt;
&lt;P&gt;Instead write your code using your own macro variable.&amp;nbsp; You can default to the date the session started if you want.&lt;/P&gt;
&lt;P&gt;Say you decide to use RUNDATE as the name of your macro variable.&amp;nbsp; In your normal code just use something like this to set the value when not provide.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if 0=%length(&amp;amp;rundate) %then %let rundate=&amp;amp;sysdate9;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;PS You should never use only two digits for the year in a date. So always use SYSDATE9 and not SYSDATE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then in your test runs just set RUNDATE before the code to be tested.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let rundate=%sysfunc(putn("&amp;amp;sysdate9"d-4,date9.));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 Sep 2020 16:00:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Over-write-sysdate-value/m-p/685745#M37066</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-09-22T16:00:23Z</dc:date>
    </item>
    <item>
      <title>Re: Over write sysdate value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Over-write-sysdate-value/m-p/685747#M37067</link>
      <description>&lt;P&gt;It's not nice to fool with system supplied variables. And SAS explicitly will not allow to change this one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Make your own instead of attempting to modify a system variable like this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The macro language is very literal. If you want to use a function that is not a macro language specific function then you call it using the %sysfunc function:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let example = %eval (%sysfunc(Today()) -4);&lt;/P&gt;
&lt;P&gt;Would assign the numeric date value of 4 days prior to Example. The %eval is required to do subtraction. Or nest the today function inside an Intnx function call to do similar:&lt;/P&gt;
&lt;P&gt;%let example2 = %sysfunc(intnx('day',%sysfunc(today()),-4));&lt;/P&gt;
&lt;P&gt;You would need yet more code if you want it in the date7. format that &amp;amp;sysdate uses.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2020 16:04:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Over-write-sysdate-value/m-p/685747#M37067</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-09-22T16:04:42Z</dc:date>
    </item>
    <item>
      <title>Re: Over write sysdate value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Over-write-sysdate-value/m-p/685912#M37068</link>
      <description>&lt;P&gt;Along with the other excellent replies, let me suggest that you NEVER name a macro variable beginning with "sys". This prefix is used for SAS system variables, and I guarantee you will CONFUSE THE HECK out of some poor devil who needs to support your program!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2020 23:45:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Over-write-sysdate-value/m-p/685912#M37068</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2020-09-22T23:45:18Z</dc:date>
    </item>
  </channel>
</rss>

