<?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: Incrementing Date Outside of Data Step in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566057#M11299</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/5059"&gt;@DavidPhillips2&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Its a point in time comparison dataset.&amp;nbsp; State of data at a particular date compared to a year back.&amp;nbsp; So querying the date once per year and unioning it with multiple years.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So make one variable with the day of the year and one variable with the year.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  set have ;
  year=year(datepart(rundate));
  day_of_year =datepart(rundate) - intnx('year',datepart(rundate),0) + 1;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 13 Jun 2019 21:07:42 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2019-06-13T21:07:42Z</dc:date>
    <item>
      <title>Incrementing Date Outside of Data Step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566004#M11284</link>
      <description>&lt;P&gt;How do I change a date variable outside of a date step?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying syntax like.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let todaydate1=%eval(intnx('year',&amp;amp;todaydate1,-1));&lt;/P&gt;
&lt;P&gt;The idea is to call this line several times.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2019 19:51:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566004#M11284</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2019-06-13T19:51:13Z</dc:date>
    </item>
    <item>
      <title>Re: Incrementing Date Outside of Data Step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566017#M11286</link>
      <description>Functions get wratpped in %SYSFUNC() so if you're using INTNX() you need to wrap it in %SYSFUNC().&lt;BR /&gt;&lt;BR /&gt;If you're doing the addition method, +1 with no INTNX function then you can use %EVAL instead.</description>
      <pubDate>Thu, 13 Jun 2019 20:04:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566017#M11286</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-06-13T20:04:47Z</dc:date>
    </item>
    <item>
      <title>Re: Incrementing Date Outside of Data Step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566019#M11287</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/5059"&gt;@DavidPhillips2&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;How do I change a date variable outside of a date step?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying syntax like.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let todaydate1=%eval(intnx('year',&amp;amp;todaydate1,-1));&lt;/P&gt;
&lt;P&gt;The idea is to call this line several times.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You cannot have a variable outside of a dataset. Looks like you are trying to change the value of macro variable.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The %EVAL() function only works on strings that look like integer arithmetic and the arithmetic and the resulting integer is then converted back into a string.&amp;nbsp; It will not understand the quotes or the letter INTNX.&lt;/P&gt;
&lt;P&gt;You can use the %SYSFUNC() macro function to access the INTNX() function. Do not add quotes around YEAR as INTNX() does not recognize the interval 'YEAR'.&lt;/P&gt;
&lt;P&gt;So assuming that TODAYDATE1 has either a date literal, like '13JUN2019'd, or a number of days value, like&amp;nbsp;21713 then this code will work.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let todaydate1=%sysfunc(intnx(year,&amp;amp;todaydate1,-1));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So if TODAYDATE1 was either of my examples then it will become&amp;nbsp;21185. Which is the number that represents the first day in 2018.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2019 20:05:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566019#M11287</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-06-13T20:05:23Z</dc:date>
    </item>
    <item>
      <title>Re: Incrementing Date Outside of Data Step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566020#M11288</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/5059"&gt;@DavidPhillips2&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;How do I change a date variable outside of a date step?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying syntax like.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let todaydate1=%eval(intnx('year',&amp;amp;todaydate1,-1));&lt;/P&gt;
&lt;P&gt;The idea is to call this line several times.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Calling data step functions requires use of %sysfunc () , not %eval.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let todaydate1=%sysfunc(intnx('year',&amp;amp;todaydate1,-1));&lt;/P&gt;
&lt;P&gt;might work depending on the actual content of &amp;amp;todaydate1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have multiple function calls each one needs its own %sysfunc () which&amp;nbsp;can lead to pretty ugly code.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2019 20:06:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566020#M11288</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-06-13T20:06:02Z</dc:date>
    </item>
    <item>
      <title>Re: Incrementing Date Outside of Data Step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566044#M11290</link>
      <description>&lt;P&gt;data todaytable;&lt;BR /&gt;tdate = today();&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql noprint;&lt;BR /&gt;select "'"||put(tdate,date9.)||":00:00:00'dt" into :todaydate1&lt;BR /&gt;from todaytable;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I try to increment it.&amp;nbsp; The variable appears to go blank.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2019 20:43:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566044#M11290</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2019-06-13T20:43:49Z</dc:date>
    </item>
    <item>
      <title>Re: Incrementing Date Outside of Data Step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566046#M11291</link>
      <description>Try this and it's helpful to post your full code - including the increment section.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;proc sql noprint;&lt;BR /&gt;select dhms(today(), 0, 0, 0) into :todaydate1;&lt;BR /&gt;quit;</description>
      <pubDate>Thu, 13 Jun 2019 20:46:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566046#M11291</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-06-13T20:46:32Z</dc:date>
    </item>
    <item>
      <title>Re: Incrementing Date Outside of Data Step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566047#M11292</link>
      <description>&lt;P&gt;&lt;BR /&gt;data todaytable;&lt;BR /&gt;tdate = today();&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql noprint;&lt;BR /&gt;select "'"||put(tdate,date9.)||":00:00:00'dt" into :todaydate1&lt;BR /&gt;from todaytable;&lt;BR /&gt;select "'"||put(tdate,date9.)||":23:59:59'dt" into :todaydate2&lt;BR /&gt;from todaytable;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%Global differenceText AcademicPeriodCounter;&lt;BR /&gt;%let differenceText = %Str();&lt;/P&gt;
&lt;P&gt;%macro createRegBioArchTables(RegBioCounter);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;create table studentsUD&amp;amp;RegBioCounter. as&lt;BR /&gt;SELECT ACADEMIC_PERIOD, &lt;BR /&gt;FROM mytable&lt;BR /&gt;where &lt;BR /&gt;rundate &amp;gt;= &amp;amp;todaydate1. and rundate &amp;lt;= &amp;amp;todaydate2.&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;%mend;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;%createRegBioArchTables(1);&lt;BR /&gt;%let todaydate1=%sysfunc(intnx(year,&amp;amp;todaydate1,-1));&lt;BR /&gt;%let todaydate2=%sysfunc(intnx(year,&amp;amp;todaydate2,-1));&lt;BR /&gt;%createRegBioArchTables(2);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;select count(*) &lt;BR /&gt;FROM mytable&lt;BR /&gt;where t1.rundate &amp;gt;= &amp;amp;todaydate1. and t1.rundate &amp;lt;= &amp;amp;todaydate2.;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%put( test &amp;amp;todaydate1.);&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2019 20:51:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566047#M11292</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2019-06-13T20:51:30Z</dc:date>
    </item>
    <item>
      <title>Re: Incrementing Date Outside of Data Step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566048#M11293</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/5059"&gt;@DavidPhillips2&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;data todaytable;&lt;BR /&gt;tdate = today();&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql noprint;&lt;BR /&gt;select "'"||put(tdate,date9.)||":00:00:00'dt" into :todaydate1&lt;BR /&gt;from todaytable;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I try to increment it.&amp;nbsp; The variable appears to go blank.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Why are you getting a today's date and converting it into a datetime literal in a macro variable?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  call symputx('todaydatetime1',cats('"',put(today(),date9.),':00:00:00"dt');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;What you are planning to do with this macro variable?&lt;/P&gt;
&lt;P&gt;Why not just leave it as the number of seconds since 1960?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  call symputx('todaydatetime1',intnx('dtday',datetime(),0));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Jun 2019 20:51:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566048#M11293</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-06-13T20:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: Incrementing Date Outside of Data Step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566050#M11294</link>
      <description>&lt;P&gt;The purpose is to query a set of records within a day and do the same query repetitively one year back at a time.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2019 20:54:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566050#M11294</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2019-06-13T20:54:20Z</dc:date>
    </item>
    <item>
      <title>Re: Incrementing Date Outside of Data Step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566051#M11295</link>
      <description>Are you trying to get daily reporting this way? There are much easier ways to do that? Or generic period reporting?</description>
      <pubDate>Thu, 13 Jun 2019 20:56:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566051#M11295</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-06-13T20:56:18Z</dc:date>
    </item>
    <item>
      <title>Re: Incrementing Date Outside of Data Step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566054#M11296</link>
      <description>Why not just group it by changing the datetime variable to a date? And using either GROUP or a BY statement?</description>
      <pubDate>Thu, 13 Jun 2019 20:58:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566054#M11296</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-06-13T20:58:12Z</dc:date>
    </item>
    <item>
      <title>Re: Incrementing Date Outside of Data Step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566055#M11297</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/5059"&gt;@DavidPhillips2&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;The purpose is to query a set of records within a day and do the same query repetitively one year back at a time.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That is not what the code you posted is doing. It is getting the data for a single day.&amp;nbsp; Then you are trying to change to the first day of the year before and are getting the data for that January 1st day.&amp;nbsp; To go back exactly a year you need to use SAME as the last parameter to the INTNX() function call.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you want the data grouped by day?&amp;nbsp; Why not just create a DATE value from your DATETIME values?&lt;/P&gt;
&lt;P&gt;Do you want the data grouped by year?&lt;/P&gt;
&lt;P&gt;Do you want a rolling interval of 365 (366) days?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2019 21:03:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566055#M11297</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-06-13T21:03:59Z</dc:date>
    </item>
    <item>
      <title>Re: Incrementing Date Outside of Data Step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566056#M11298</link>
      <description>&lt;P&gt;Its a point in time comparison dataset.&amp;nbsp; State of data at a particular date compared to a year back.&amp;nbsp; So querying the date once per year and unioning it with multiple years.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2019 21:04:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566056#M11298</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2019-06-13T21:04:33Z</dc:date>
    </item>
    <item>
      <title>Re: Incrementing Date Outside of Data Step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566057#M11299</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/5059"&gt;@DavidPhillips2&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Its a point in time comparison dataset.&amp;nbsp; State of data at a particular date compared to a year back.&amp;nbsp; So querying the date once per year and unioning it with multiple years.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So make one variable with the day of the year and one variable with the year.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  set have ;
  year=year(datepart(rundate));
  day_of_year =datepart(rundate) - intnx('year',datepart(rundate),0) + 1;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Jun 2019 21:07:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566057#M11299</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-06-13T21:07:42Z</dc:date>
    </item>
    <item>
      <title>Re: Incrementing Date Outside of Data Step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566063#M11302</link>
      <description>&lt;P&gt;Since you don't care about the time of day don't include it in your macro variable.&amp;nbsp; You don't need two macro variables.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let date=%sysfunc(today(),date9);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then use that value in your code&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;rundate between "&amp;amp;date:00:00:00"dt and "&amp;amp;date:23:59:59"dt&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then to change it use the INTNX() function with YEAR interval (instead of the DTYEAR interval your would have needed for a datetime value).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let date=%sysfunc(intnx(year,"&amp;amp;date"d,-1,s),date9);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2019 21:23:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566063#M11302</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-06-13T21:23:05Z</dc:date>
    </item>
    <item>
      <title>Re: Incrementing Date Outside of Data Step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566064#M11303</link>
      <description>&lt;P&gt;Assuming you have some reason for doing this, or are too far down this route to consider a redesign here's a modification that may help:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some changes:&lt;BR /&gt;1. Generate a temp table instead of multiple and append them to the master at the top of the program&lt;/P&gt;
&lt;P&gt;2. Call the macro from a data step directly, incrementing the dates there to avoid any macro issues.&lt;/P&gt;
&lt;P&gt;3. Add a datepart() to simply the filtering&lt;/P&gt;
&lt;P&gt;4. clean up after&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this doesn't apply, feel free to ignore it!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that dates don't have to be formatted as dates for this to work, the number values are perfectly fine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%Global differenceText AcademicPeriodCounter;
%let differenceText = %Str();



%macro createRegBioArchTables(RegBioCounter=, ddate = );

 

proc sql;
create table _temp as
SELECT ACADEMIC_PERIOD, 
FROM mytable
where 
datepart(rundate) = &amp;amp;ddate.;
quit;

proc append base = want data =_temp force;
run;

proc sql;
drop table _temp;
quit;

%mend;

data demo;
do date='01Jan2019'd to '31Jan2019'd;
str = catt('%createRegBioArchTables(RegBioCounter=', _n_,  ' ,ddate=', date, ');');
output;
*call execute(str);
end;

run;
&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Jun 2019 21:29:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566064#M11303</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-06-13T21:29:00Z</dc:date>
    </item>
    <item>
      <title>Re: Incrementing Date Outside of Data Step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566191#M11312</link>
      <description>&lt;P&gt;I'm querying today's date to see what datetimes stored in the large transaction table fall within today's date.&amp;nbsp; The feeding the two date ranges into a where clause.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I use the number of seconds from 1960, how do I insert the result into a where clause and increment it back a year.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2019 15:02:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566191#M11312</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2019-06-14T15:02:59Z</dc:date>
    </item>
    <item>
      <title>Re: Incrementing Date Outside of Data Step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566198#M11313</link>
      <description>&lt;P&gt;I think this branch is the right way to go working on some minor details with it.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2019 15:13:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566198#M11313</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2019-06-14T15:13:05Z</dc:date>
    </item>
    <item>
      <title>Re: Incrementing Date Outside of Data Step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566201#M11314</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/5059"&gt;@DavidPhillips2&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I'm querying today's date to see what datetimes stored in the large transaction table fall within today's date.&amp;nbsp; The feeding the two date ranges into a where clause.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I use the number of seconds from 1960, how do I insert the result into a where clause and increment it back a year.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Same as changing a date by a year, use the INTNX function. Use interval DTYEAR so SAS know you are incrementing a datetime value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data example;
   x= dhms(today(),9,15,20);
   format x datetime20.;
   y1 = intnx('dtyear',x,-1,'b');
   y2 = intnx('dtyear',x,-1,'s');
   y3 = intnx('dtyear',x,-1,'e');
   format y: datetime20.;
run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Jun 2019 15:16:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Incrementing-Date-Outside-of-Data-Step/m-p/566201#M11314</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-06-14T15:16:52Z</dc:date>
    </item>
  </channel>
</rss>

