<?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: Update date automatically in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Update-date-automatically/m-p/808885#M318952</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/226565"&gt;@japelin&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;If the execution is on Monday, how about simply using date function as today?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;and cova_evnt_efcv_dt between '01Jan2021'd and date()&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I like your answer better than mine!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;... unless you need today's date in titles, in which case you would need the macro variable approach (and you would have to apply a format to it if you were going to use it in the title)&lt;/P&gt;</description>
    <pubDate>Wed, 20 Apr 2022 17:20:53 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2022-04-20T17:20:53Z</dc:date>
    <item>
      <title>Update date automatically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-date-automatically/m-p/808870#M318946</link>
      <description>&lt;P&gt;hello, i was running a report monthly and it is moving to weekly. I am trying to solve for having the end date on this date parameter update automatically weekly (every Monday). the report I run Monday should be&amp;nbsp; &lt;CODE class=" language-sas"&gt;cova_evnt_efcv_dt between&amp;nbsp;'01Jan2021'd and '25Apr2022'd&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;and the following Monday the dates whould be &lt;CODE class=" language-sas"&gt;cova_evnt_efcv_dt between&amp;nbsp;'01Jan2021'd and '02May2022'd&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;I want the end date to update automaically every Monday for a YTD reprot. Can someone provide guidance with this?&amp;nbsp;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;and cova_evnt_efcv_dt between '01Jan2021'd and '31Mar2022'd&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 16:36:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-date-automatically/m-p/808870#M318946</guid>
      <dc:creator>LMSSAS</dc:creator>
      <dc:date>2022-04-20T16:36:18Z</dc:date>
    </item>
    <item>
      <title>Re: Update date automatically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-date-automatically/m-p/808878#M318947</link>
      <description>&lt;P&gt;At the start of your program&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let today=%sysfunc(today());&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and then later&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;cova_evnt_efcv_dt between '01Jan2021'd and &amp;amp;today&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 17:00:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-date-automatically/m-p/808878#M318947</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-04-20T17:00:21Z</dc:date>
    </item>
    <item>
      <title>Re: Update date automatically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-date-automatically/m-p/808880#M318949</link>
      <description>&lt;P&gt;If the execution is on Monday, how about simply using date function as today?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;and cova_evnt_efcv_dt between '01Jan2021'd and date()&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or, if you want to run it as of Monday of this week, you can also do the following code.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  /* monday in this week. If you change the 3rd. parameter from 0 to 1, you can specify next Monday */
  monday= intnx( 'week', date(), 0, 'beginning')+1;
  call symputx('end_date',monday);
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;how to use it.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;and cova_evnt_efcv_dt between '01Jan2021'd and &amp;amp;end_date&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 17:01:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-date-automatically/m-p/808880#M318949</guid>
      <dc:creator>japelin</dc:creator>
      <dc:date>2022-04-20T17:01:24Z</dc:date>
    </item>
    <item>
      <title>Re: Update date automatically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-date-automatically/m-p/808883#M318950</link>
      <description>&lt;P&gt;Are you always looking a year back?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
	cova_evnt_efcv_dt = '01JAN1960'd; output;
	cova_evnt_efcv_dt = '01JAN2021'd; output;
	cova_evnt_efcv_dt = '21APR2022'd; output;
	cova_evnt_efcv_dt = '20APR2022'd; output;
	cova_evnt_efcv_dt = '23JAN2020'd; output;
	cova_evnt_efcv_dt = '01JAN2021'd; output;
	cova_evnt_efcv_dt = '30MAR2022'd; output;
	cova_evnt_efcv_dt = '21MAR2022'd; output;
	cova_evnt_efcv_dt = '28JUN2022'd; output;
	format cova_evnt_efcv_dt date9.;
run;

proc sql;
	select
				*
	from
				want
	where
				cova_evnt_efcv_dt between mdy(1, 1, year(today()) - 1) and today();
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;`today()` would be based on when you run the report. If you automated it every Monday, you wouldn't have to look at it anymore.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 17:04:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-date-automatically/m-p/808883#M318950</guid>
      <dc:creator>maguiremq</dc:creator>
      <dc:date>2022-04-20T17:04:34Z</dc:date>
    </item>
    <item>
      <title>Re: Update date automatically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-date-automatically/m-p/808884#M318951</link>
      <description>Thank you!!</description>
      <pubDate>Wed, 20 Apr 2022 17:09:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-date-automatically/m-p/808884#M318951</guid>
      <dc:creator>LMSSAS</dc:creator>
      <dc:date>2022-04-20T17:09:41Z</dc:date>
    </item>
    <item>
      <title>Re: Update date automatically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-date-automatically/m-p/808885#M318952</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/226565"&gt;@japelin&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;If the execution is on Monday, how about simply using date function as today?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;and cova_evnt_efcv_dt between '01Jan2021'd and date()&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I like your answer better than mine!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;... unless you need today's date in titles, in which case you would need the macro variable approach (and you would have to apply a format to it if you were going to use it in the title)&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 17:20:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-date-automatically/m-p/808885#M318952</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-04-20T17:20:53Z</dc:date>
    </item>
    <item>
      <title>Re: Update date automatically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-date-automatically/m-p/808886#M318953</link>
      <description>No, I'm not always looking a year back. it will be YTD starting every year. Unless the customer changes their mind, which is always possible. &lt;BR /&gt;&lt;BR /&gt;thank you!</description>
      <pubDate>Wed, 20 Apr 2022 17:12:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-date-automatically/m-p/808886#M318953</guid>
      <dc:creator>LMSSAS</dc:creator>
      <dc:date>2022-04-20T17:12:29Z</dc:date>
    </item>
    <item>
      <title>Re: Update date automatically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-date-automatically/m-p/808887#M318954</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/393528"&gt;@LMSSAS&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;No, I'm not always looking a year back. it will be YTD starting every year. Unless the customer changes their mind, which is always possible. &lt;BR /&gt;&lt;BR /&gt;thank you!&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;In that case, use this (giving credit to &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/226565"&gt;@japelin&lt;/a&gt;&amp;nbsp;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;and cova_evnt_efcv_dt between intnx('year',today(),0,'b') and today()&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Apr 2022 17:15:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-date-automatically/m-p/808887#M318954</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-04-20T17:15:34Z</dc:date>
    </item>
  </channel>
</rss>

