<?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: creating before and after dates using other dates variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/creating-before-and-after-dates-using-other-dates-variables/m-p/862423#M340667</link>
    <description>&lt;P&gt;And example data in the form of a working data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We see way too many people post numbers like 20190430 claiming they are "dates". But aren't.&lt;/P&gt;</description>
    <pubDate>Mon, 06 Mar 2023 16:21:02 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2023-03-06T16:21:02Z</dc:date>
    <item>
      <title>creating before and after dates using other dates variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-before-and-after-dates-using-other-dates-variables/m-p/862395#M340650</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;I am trying to create a before and after specific date based on month and days on two/four other dates depending on a frequency variable. Here is an example of my date:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;transac_date freq first_date second_date third_date fourth_date&lt;BR /&gt;20150102 2 20190430 20191030 .&lt;BR /&gt;20100302 2 20190430 20191030 .&lt;BR /&gt;20121102 2 20190430 20191030 .&lt;BR /&gt;20020716 4 20250228 20250531 20250831&lt;BR /&gt;20021211 4 20250228 20250531 20250831&lt;BR /&gt;20030108 4 20250228 20250531 20250831&lt;/PRE&gt;&lt;P&gt;What I need looks like this:&lt;/P&gt;&lt;PRE&gt;transac_date freq first_date second_date third_date fourth_date before_tran_date after_trans_date&lt;BR /&gt;20150102 2 20190430 20191030 . . &lt;STRONG&gt;20141030 20150430&lt;/STRONG&gt;&lt;BR /&gt;20100302 2 20190430 20191030 . . &lt;STRONG&gt;20091030 20100430&lt;/STRONG&gt;&lt;BR /&gt;20121102 2 20190430 20191030 . . &lt;STRONG&gt;20121030 20130430&lt;/STRONG&gt;&lt;BR /&gt;20020716 4 20250228 20250531 20250831 &lt;SPAN&gt;20251130 &lt;STRONG&gt;20020531 20020831&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;20121211 4 20250228 20250531 20250831 &lt;SPAN&gt;20251130 &lt;STRONG&gt;20121130 20130228&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;20030108 4 20250228 20250531 20250831 &lt;SPAN&gt;20251130 &lt;STRONG&gt;20021130 20030228&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;Any help is greatly appreciated!&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2023 01:14:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-before-and-after-dates-using-other-dates-variables/m-p/862395#M340650</guid>
      <dc:creator>AmirSari</dc:creator>
      <dc:date>2023-03-06T01:14:29Z</dc:date>
    </item>
    <item>
      <title>Re: creating before and after dates using other dates variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-before-and-after-dates-using-other-dates-variables/m-p/862415#M340664</link>
      <description>&lt;P&gt;Please post the rule for calculating these new variables.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2023 05:58:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-before-and-after-dates-using-other-dates-variables/m-p/862415#M340664</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-03-06T05:58:02Z</dc:date>
    </item>
    <item>
      <title>Re: creating before and after dates using other dates variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-before-and-after-dates-using-other-dates-variables/m-p/862423#M340667</link>
      <description>&lt;P&gt;And example data in the form of a working data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We see way too many people post numbers like 20190430 claiming they are "dates". But aren't.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2023 16:21:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-before-and-after-dates-using-other-dates-variables/m-p/862423#M340667</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-03-06T16:21:02Z</dc:date>
    </item>
    <item>
      <title>Re: creating before and after dates using other dates variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-before-and-after-dates-using-other-dates-variables/m-p/862425#M340668</link>
      <description>&lt;P&gt;I can’t update my original post but what I am trying to do is to create the interest payment dates before and after the transaction date, i.e. transac_date based on the interest payment dates for a random year and given the frequency of the interest payments.&amp;nbsp;&lt;SPAN&gt;For example, in the first row of the sample data, freq=2 so interest is paid twice a year on the same day of the month each year. I have the payment dates for 2019. The first payment occurs on April 30, and the second one on October 30. the transaction date is January 2, 2015, so the payment before this transaction date occurs on&amp;nbsp;October 30, 2014, and the second payment occurs on&amp;nbsp;April 30, 2015. The frequency of the interest payments can be 2, 4, or 12.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here is the example data set with dates.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data have;
input transac_date :yymmdd10. freq first_date :yymmdd10. second_date :yymmdd10. third_date :yymmdd10. fourth_date :yymmdd10.;
format transac_date first_date second_date third_date fourth_date:yymmdd10.;
cards;
20150102 2 20190430 20191030 . .
20100302 2 20190430 20191030 . .
20121102 2 20190430 20191030 . .
20020716 4 20250228 20250531 20250831 20251130
20021211 4 20250228 20250531 20250831 20251130
20030108 4 20250228 20250531 20250831 20251130
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Mar 2023 07:04:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-before-and-after-dates-using-other-dates-variables/m-p/862425#M340668</guid>
      <dc:creator>AmirSari</dc:creator>
      <dc:date>2023-03-06T07:04:49Z</dc:date>
    </item>
    <item>
      <title>Re: creating before and after dates using other dates variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-before-and-after-dates-using-other-dates-variables/m-p/862455#M340681</link>
      <description>&lt;P&gt;See this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
select (freq);
  when (2) cadence = 6;
  when (4) cadence = 3;
  when (12) cadence = 1;
end; 
format before_tran_date after_tran_date yymmdd10.;
before_tran_date = first_date;
do while (before_tran_date ge transac_date);
  before_tran_date = intnx('month',before_tran_date,-cadence,'e');
end;
after_tran_date = intnx('month',before_tran_date,cadence,'e');
drop cadence;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Mar 2023 10:42:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-before-and-after-dates-using-other-dates-variables/m-p/862455#M340681</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-03-06T10:42:36Z</dc:date>
    </item>
    <item>
      <title>Re: creating before and after dates using other dates variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-before-and-after-dates-using-other-dates-variables/m-p/862518#M340709</link>
      <description>Thank you! This works like a charm.</description>
      <pubDate>Mon, 06 Mar 2023 16:24:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-before-and-after-dates-using-other-dates-variables/m-p/862518#M340709</guid>
      <dc:creator>AmirSari</dc:creator>
      <dc:date>2023-03-06T16:24:25Z</dc:date>
    </item>
  </channel>
</rss>

