<?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: change expiration indicator to day after due date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/change-expiration-indicator-to-day-after-due-date/m-p/435458#M108199</link>
    <description>&lt;P&gt;The code you posted will not help anything until you give some sample data you have and how you want the output.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Did you look at SAS function INTNX() where you can get the start or end date of the month with interval.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 08 Feb 2018 21:40:50 GMT</pubDate>
    <dc:creator>SuryaKiran</dc:creator>
    <dc:date>2018-02-08T21:40:50Z</dc:date>
    <item>
      <title>change expiration indicator to day after due date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/change-expiration-indicator-to-day-after-due-date/m-p/435426#M108187</link>
      <description>&lt;P&gt;Hi guys. I'm trying to figure out a way to show a certain date as expired the day after the due date. The back story: We keep track of training. Training is due on the last day of the month. Individuals have until the last day of the month to complete training. If not complete on the last day, the 1st day of the next month it should be expired. The way the query is set up, the training shows expired ON the last day...not the day after. So that really throws off our compliance measurements. I'm trying to figure out a way so that if the training is not complete by the 1st of the next month, then it will show expired for the previous month's measurements. I've attached a portion of the query I believe deals with the expiration date.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 20:42:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/change-expiration-indicator-to-day-after-due-date/m-p/435426#M108187</guid>
      <dc:creator>antjonz</dc:creator>
      <dc:date>2018-02-08T20:42:31Z</dc:date>
    </item>
    <item>
      <title>Re: change expiration indicator to day after due date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/change-expiration-indicator-to-day-after-due-date/m-p/435454#M108196</link>
      <description>&lt;P&gt;2 macros, 7 proc sql calls, 1 data step, I'm not counting the variables, and no comments as to what any of this does, and no place I can tell where a variable is actually assigned as expired or which variable holds a likely date.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which variable contains the date information that should be one day later?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 21:29:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/change-expiration-indicator-to-day-after-due-date/m-p/435454#M108196</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-02-08T21:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: change expiration indicator to day after due date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/change-expiration-indicator-to-day-after-due-date/m-p/435458#M108199</link>
      <description>&lt;P&gt;The code you posted will not help anything until you give some sample data you have and how you want the output.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Did you look at SAS function INTNX() where you can get the start or end date of the month with interval.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 21:40:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/change-expiration-indicator-to-day-after-due-date/m-p/435458#M108199</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-02-08T21:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: change expiration indicator to day after due date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/change-expiration-indicator-to-day-after-due-date/m-p/435563#M108220</link>
      <description>&lt;P&gt;In a nutshell, try this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data WANT;
  due_dt='01mar2017'd;
  exp_dt=intnx('day',due_dt,1);
format due_dt exp_dt date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hope it helps.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 09:09:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/change-expiration-indicator-to-day-after-due-date/m-p/435563#M108220</guid>
      <dc:creator>ShiroAmada</dc:creator>
      <dc:date>2018-02-09T09:09:22Z</dc:date>
    </item>
    <item>
      <title>Re: change expiration indicator to day after due date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/change-expiration-indicator-to-day-after-due-date/m-p/435628#M108240</link>
      <description>&lt;P&gt;my apologies. I'm still kinda new to SAS. I've attached an excel output of the raw data that is returned when I run the query. The "Due Date" column is the end of the applicable month, and the "status" column shows "expired". It should not expire on the due date if it hasn't been done yet. I want it to show expired the next day if not done.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 13:14:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/change-expiration-indicator-to-day-after-due-date/m-p/435628#M108240</guid>
      <dc:creator>antjonz</dc:creator>
      <dc:date>2018-02-09T13:14:12Z</dc:date>
    </item>
    <item>
      <title>Re: change expiration indicator to day after due date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/change-expiration-indicator-to-day-after-due-date/m-p/435635#M108242</link>
      <description>&lt;P&gt;Thanks for the reply. I'm still kinda new at this. Please see below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;macro set_up_dates();&lt;BR /&gt;%global _dt_0dy _dt_0dy_sas&lt;BR /&gt;_dt_0yr _dt_0yr_sas&lt;BR /&gt;_dt_0ye _dt_0ye_sas;&lt;BR /&gt;data _null_;&lt;BR /&gt;m = tranwrd(put(month(&amp;amp;rundate.), 2.), ' ', '0');&lt;BR /&gt;d = tranwrd(put(day(&amp;amp;rundate.), 2.), ' ', '0');&lt;BR /&gt;y = put(year(&amp;amp;rundate.), 4.);&lt;BR /&gt;call symput('_dt_0dy_sas', &amp;amp;rundate.);&lt;BR /&gt;call symput('_dt_0dy', compress("'"||y||'-'||m||'-'||d||"'"));&lt;/P&gt;&lt;P&gt;m = '01';&lt;BR /&gt;d = '01';&lt;BR /&gt;y = put(year(&amp;amp;rundate.), 4.);&lt;BR /&gt;call symput('_dt_0yr_sas', mdy(1,1,year(&amp;amp;rundate.)));&lt;BR /&gt;call symput('_dt_0yr', compress("'"||y||'-'||m||'-'||d||"'"));&lt;/P&gt;&lt;P&gt;m = '12';&lt;BR /&gt;d = '31';&lt;BR /&gt;y = put(year(&amp;amp;rundate.), 4.);&lt;BR /&gt;call symput('_dt_0ye_sas', mdy(12,31,year(&amp;amp;rundate.)));&lt;BR /&gt;call symput('_dt_0ye', compress("'"||y||'-'||m||'-'||d||"'"));&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;%mend;&lt;BR /&gt;%macro get_base_data();&lt;BR /&gt;proc sql;&lt;BR /&gt;connect to teradata (tdpid = 'dwprod' user = &amp;amp;terauser_prd. password = &amp;amp;terapass_prd. mode=teradata);&lt;BR /&gt;create table _calendar as&lt;BR /&gt;select *&lt;BR /&gt;from connection to teradata&lt;BR /&gt;(&lt;BR /&gt;LOCKING TechOps_DataLab.TBL_AC_OPSSPEC FOR ACCESS&lt;BR /&gt;select extract(year from cal_dt) as cal_yr&lt;BR /&gt;,extract(month from cal_dt) as cal_mo&lt;BR /&gt;,count(1) as cal_dy_cnt&lt;BR /&gt;from stdmv.calendar&lt;BR /&gt;where cal_dt between date &amp;amp;_dt_0yr. and date &amp;amp;_dt_0ye.&lt;BR /&gt;group by 1, 2&lt;BR /&gt;order by 1, 2&lt;BR /&gt;);&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 13:32:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/change-expiration-indicator-to-day-after-due-date/m-p/435635#M108242</guid>
      <dc:creator>antjonz</dc:creator>
      <dc:date>2018-02-09T13:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: change expiration indicator to day after due date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/change-expiration-indicator-to-day-after-due-date/m-p/435699#M108260</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/161589"&gt;@antjonz&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Thanks for the reply. I'm still kinda new at this. Please see below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;macro set_up_dates();&lt;BR /&gt;%global _dt_0dy _dt_0dy_sas&lt;BR /&gt;_dt_0yr _dt_0yr_sas&lt;BR /&gt;_dt_0ye _dt_0ye_sas;&lt;BR /&gt;data _null_;&lt;BR /&gt;m = tranwrd(put(month(&amp;amp;rundate.), 2.), ' ', '0'); &lt;FONT color="#ff0000"&gt;&lt;STRONG&gt;&amp;lt;= What does RUNDATE look like, not shown anywhere&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;d = tranwrd(put(day(&amp;amp;rundate.), 2.), ' ', '0');&amp;nbsp;&amp;nbsp; &lt;BR /&gt;y = put(year(&amp;amp;rundate.), 4.);&lt;BR /&gt;call symput('_dt_0dy_sas', &amp;amp;rundate.);&lt;BR /&gt;call symput('_dt_0dy', compress("'"||y||'-'||m||'-'||d||"'"));&amp;nbsp; &lt;STRONG&gt;&lt;FONT color="#ff0000"&gt;&amp;lt;= if your "rundate" is an actual sas date value then a format would take care of all the m, d, y stuff&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;m = '01';&lt;BR /&gt;d = '01';&lt;BR /&gt;y = put(year(&amp;amp;rundate.), 4.);&lt;BR /&gt;call symput('_dt_0yr_sas', mdy(1,1,year(&amp;amp;rundate.)));&lt;BR /&gt;call symput('_dt_0yr', compress("'"||y||'-'||m||'-'||d||"'")); &lt;STRONG&gt;&lt;FONT color="#ff0000"&gt;&amp;lt;= if your rundate is a sas date value then this value is intnx('year',rundate,0,'B');&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;m = '12';&lt;BR /&gt;d = '31';&lt;BR /&gt;y = put(year(&amp;amp;rundate.), 4.);&lt;BR /&gt;call symput('_dt_0ye_sas', mdy(12,31,year(&amp;amp;rundate.)));&lt;BR /&gt;call symput('_dt_0ye', compress("'"||y||'-'||m||'-'||d||"'"));&amp;nbsp;&lt;STRONG&gt;&lt;FONT color="#ff0000"&gt;&amp;lt;= if your rundate is a sas date value then this value is intnx('year',rundate,0,'E');&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;%mend;&lt;BR /&gt;%macro get_base_data();&lt;BR /&gt;proc sql;&lt;BR /&gt;connect to teradata (tdpid = 'dwprod' user = &amp;amp;terauser_prd. password = &amp;amp;terapass_prd. mode=teradata);&lt;BR /&gt;create table _calendar as&lt;BR /&gt;select *&lt;BR /&gt;from connection to teradata&lt;BR /&gt;(&lt;BR /&gt;LOCKING TechOps_DataLab.TBL_AC_OPSSPEC FOR ACCESS&lt;BR /&gt;select extract(year from cal_dt) as cal_yr&lt;BR /&gt;,extract(month from cal_dt) as cal_mo&lt;BR /&gt;,count(1) as cal_dy_cnt&lt;BR /&gt;from stdmv.calendar&lt;BR /&gt;where cal_dt between date &amp;amp;_dt_0yr. and date &amp;amp;_dt_0ye.&lt;BR /&gt;group by 1, 2&lt;BR /&gt;order by 1, 2&lt;BR /&gt;);&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It looks like your data _null_ might be reducible to&lt;/P&gt;
&lt;PRE&gt;%let rundate= '15Mar2017'd;
data _null_;
   call symputx('_dt_0dy_sas', &amp;amp;rundate.);
   Call symputx('_dt_0dy',put(&amp;amp;rundate,yymmddD10.));
   call symputx('_dt_0yr_sas', intnx('year',&amp;amp;rundate,0,'B'));
   call symputx('_dt_0yr',put(intnx('year',&amp;amp;rundate,0,'B'),yymmddD10.));
   call symputx('_dt_0ye',put(intnx('year',&amp;amp;rundate,0,'E'),yymmddD10.));
   call symputx('_dt_0ye_sas', intnx('year',&amp;amp;rundate,0,'E'));
run;

%put &amp;amp;dt_0dy &amp;amp;_dt_0yr &amp;amp;_dt_0ye;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However I don't think you have indemnified the variable that needs to be "incremented"&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 16:37:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/change-expiration-indicator-to-day-after-due-date/m-p/435699#M108260</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-02-09T16:37:48Z</dc:date>
    </item>
    <item>
      <title>Re: change expiration indicator to day after due date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/change-expiration-indicator-to-day-after-due-date/m-p/435736#M108273</link>
      <description>&lt;P&gt;Thanks! That's helpful. to answer your question about the indemnified variable, I believe the variable is the "status". The status will show expired based on the due date. For example, a course is due every 12 months and it's due the last day of&amp;nbsp;that 12th month. However, the status is showing expired on that last day when it shouldn't actually exire until the NEXT day:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table _course_summary as&lt;BR /&gt;select year(file_dt) as yr&lt;BR /&gt;,month(file_dt) as mo&lt;BR /&gt;,o.delta_department&lt;BR /&gt;,o.contractor_ind&lt;BR /&gt;,o.hr_stn_cd&lt;BR /&gt;,sum(case when o.status = 'EXPIRED' then 1 else 0 end) as c_expired&lt;BR /&gt;,count(distinct case when o.status = 'EXPIRED' then o.empl_nbr else '' end) as e_expired&lt;BR /&gt;from _lms_raw o&lt;BR /&gt;where o.status = 'EXPIRED'&lt;BR /&gt;group by 1, 2, 3, 4, 5&lt;BR /&gt;order by 1, 2, 3, 4, 5;&lt;BR /&gt;create table _dep_summary as&lt;BR /&gt;select p.delta_department&lt;BR /&gt;,p.contractor_ind&lt;BR /&gt;,p.hr_stn_cd&lt;BR /&gt;,count(distinct p.p_unique_key) as emp_cnt&lt;BR /&gt;from trn._person p&lt;BR /&gt;where p.delta_department not in ('','XXX')&lt;BR /&gt;group by 1, 2, 3&lt;BR /&gt;order by 1, 2, 3;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 17:47:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/change-expiration-indicator-to-day-after-due-date/m-p/435736#M108273</guid>
      <dc:creator>antjonz</dc:creator>
      <dc:date>2018-02-09T17:47:25Z</dc:date>
    </item>
  </channel>
</rss>

