<?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: Converting and splitting a date to a fiscal year in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Converting-and-splitting-a-date-to-a-fiscal-year/m-p/724715#M225015</link>
    <description>&lt;P&gt;If you are using the fiscal year convention in the US&amp;nbsp; (fiscal year&amp;nbsp; &amp;nbsp; xxxx runs from June xxxx&amp;nbsp; through May xxxx+1), then&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;   fyear=year(intnx('year.6',fy_enddate,0,'beg'));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The INTNX function "advances" the date value in FY_ENDDATE by 0 years, and aligns the result to the date beginning that year.&amp;nbsp; But I am using "year.6" as the interval, not "year".&amp;nbsp; &amp;nbsp;"Year.6" identifies year intervals that begin in June.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Run the program below to see a 12-month series assigning fiscal years as you require:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
 fy_enddate='31jan2019'd;
 do until (fy_enddate&amp;gt;'31dec2019'd);
   fyear=year(intnx('year.6',fy_enddate,0,'beg'));
   put fy_enddate=date9. fyear=;
   fy_enddate=intnx('month',fy_enddate,1,'end');
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;No if test or other conditional programming statement required - just a function.&lt;/P&gt;</description>
    <pubDate>Tue, 09 Mar 2021 00:16:21 GMT</pubDate>
    <dc:creator>mkeintz</dc:creator>
    <dc:date>2021-03-09T00:16:21Z</dc:date>
    <item>
      <title>Converting and splitting a date to a fiscal year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-and-splitting-a-date-to-a-fiscal-year/m-p/724703#M225009</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a task which I need to "Create a new variable, FYEAR.&amp;nbsp; If the month the fiscal year ended was June through December then FYEAR will equal the year in the FISCAL_YEAR_ENDED date.&amp;nbsp; If the month the fiscal year ended was January through May, then FYEAR will equal the year in the FISCAL_YEAR_ENDED date less one."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The format of my current set up is fiscal_year_ended DAMONYEAR 2 digits for the date, 3 for the month and 4 for the year. For example today (March 8th 2021) would show up as 08MAR2021.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I instruct SAS to decipher the fiscal years? I first started by splitting the date such as&amp;nbsp;&lt;/P&gt;&lt;P&gt;data mergedata1; set mergedata;&lt;BR /&gt;year=year(fiscal_year_ended);&lt;BR /&gt;month=month(fiscal_year_ended);&lt;BR /&gt;day=day(fiscal_year_ended);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but now I'm looking to tell SAS whether the fiscal year and fiscal year ended should be the same?&lt;/P&gt;</description>
      <pubDate>Mon, 08 Mar 2021 23:39:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-and-splitting-a-date-to-a-fiscal-year/m-p/724703#M225009</guid>
      <dc:creator>krg1140</dc:creator>
      <dc:date>2021-03-08T23:39:30Z</dc:date>
    </item>
    <item>
      <title>Re: Converting and splitting a date to a fiscal year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-and-splitting-a-date-to-a-fiscal-year/m-p/724704#M225010</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;FYEAR = year(fiscal_year_ended) - 1*(month(fiscal_year_ended) &amp;lt; 6);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;(month(fiscal_year_ended) &amp;lt; 6) will evaluate to a 0 or 1. If it's less than 6 it evaluates to 1, which becomes year(fiscal_year_ended) - 1* 1 = year-1&lt;BR /&gt;I'll leave the math for the 0 to you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/372958"&gt;@krg1140&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a task which I need to "Create a new variable, FYEAR.&amp;nbsp; If the month the fiscal year ended was June through December then FYEAR will equal the year in the FISCAL_YEAR_ENDED date.&amp;nbsp; If the month the fiscal year ended was January through May, then FYEAR will equal the year in the FISCAL_YEAR_ENDED date less one."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The format of my current set up is fiscal_year_ended DAMONYEAR 2 digits for the date, 3 for the month and 4 for the year. For example today (March 8th 2021) would show up as 08MAR2021.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I instruct SAS to decipher the fiscal years? I first started by splitting the date such as&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data mergedata1; set mergedata;&lt;BR /&gt;year=year(fiscal_year_ended);&lt;BR /&gt;month=month(fiscal_year_ended);&lt;BR /&gt;day=day(fiscal_year_ended);&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but now I'm looking to tell SAS whether the fiscal year and fiscal year ended should be the same?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Mar 2021 23:45:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-and-splitting-a-date-to-a-fiscal-year/m-p/724704#M225010</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-03-08T23:45:51Z</dc:date>
    </item>
    <item>
      <title>Re: Converting and splitting a date to a fiscal year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-and-splitting-a-date-to-a-fiscal-year/m-p/724705#M225011</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;nbsp;The format of my current set up is fiscal_year_ended DAMONYEAR&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Is this a string or a SAS date?&lt;/P&gt;</description>
      <pubDate>Mon, 08 Mar 2021 23:47:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-and-splitting-a-date-to-a-fiscal-year/m-p/724705#M225011</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-03-08T23:47:32Z</dc:date>
    </item>
    <item>
      <title>Re: Converting and splitting a date to a fiscal year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-and-splitting-a-date-to-a-fiscal-year/m-p/724715#M225015</link>
      <description>&lt;P&gt;If you are using the fiscal year convention in the US&amp;nbsp; (fiscal year&amp;nbsp; &amp;nbsp; xxxx runs from June xxxx&amp;nbsp; through May xxxx+1), then&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;   fyear=year(intnx('year.6',fy_enddate,0,'beg'));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The INTNX function "advances" the date value in FY_ENDDATE by 0 years, and aligns the result to the date beginning that year.&amp;nbsp; But I am using "year.6" as the interval, not "year".&amp;nbsp; &amp;nbsp;"Year.6" identifies year intervals that begin in June.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Run the program below to see a 12-month series assigning fiscal years as you require:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
 fy_enddate='31jan2019'd;
 do until (fy_enddate&amp;gt;'31dec2019'd);
   fyear=year(intnx('year.6',fy_enddate,0,'beg'));
   put fy_enddate=date9. fyear=;
   fy_enddate=intnx('month',fy_enddate,1,'end');
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;No if test or other conditional programming statement required - just a function.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Mar 2021 00:16:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-and-splitting-a-date-to-a-fiscal-year/m-p/724715#M225015</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2021-03-09T00:16:21Z</dc:date>
    </item>
    <item>
      <title>Re: Converting and splitting a date to a fiscal year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-and-splitting-a-date-to-a-fiscal-year/m-p/724717#M225016</link>
      <description>&lt;P&gt;And format FYEAR with format &lt;FONT face="courier new,courier"&gt;year.&lt;/FONT&gt;&amp;nbsp; .&lt;/P&gt;</description>
      <pubDate>Tue, 09 Mar 2021 00:21:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-and-splitting-a-date-to-a-fiscal-year/m-p/724717#M225016</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-03-09T00:21:03Z</dc:date>
    </item>
    <item>
      <title>Re: Converting and splitting a date to a fiscal year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-and-splitting-a-date-to-a-fiscal-year/m-p/724718#M225017</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;And format FYEAR with format &lt;FONT face="courier new,courier"&gt;year.&lt;/FONT&gt;&amp;nbsp; .&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Afraid not.&amp;nbsp; There is a YEAR function applied to the intnx result.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Mar 2021 00:22:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-and-splitting-a-date-to-a-fiscal-year/m-p/724718#M225017</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2021-03-09T00:22:19Z</dc:date>
    </item>
    <item>
      <title>Re: Converting and splitting a date to a fiscal year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-and-splitting-a-date-to-a-fiscal-year/m-p/724719#M225018</link>
      <description>Fair enough. I saw that you had provided the solution I had in mind but didn't see you'd decided to extract the year. All good.&lt;BR /&gt;</description>
      <pubDate>Tue, 09 Mar 2021 00:26:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-and-splitting-a-date-to-a-fiscal-year/m-p/724719#M225018</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-03-09T00:26:45Z</dc:date>
    </item>
  </channel>
</rss>

