<?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: Customizing a fiscal year in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Customizing-a-fiscal-year/m-p/473047#M285853</link>
    <description>&lt;P&gt;First, is your "date" a SAS date valued numeric or character?&lt;/P&gt;</description>
    <pubDate>Mon, 25 Jun 2018 15:32:39 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-06-25T15:32:39Z</dc:date>
    <item>
      <title>Customizing a fiscal year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Customizing-a-fiscal-year/m-p/473042#M285852</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way where I can start my fiscal year on 1june and start the count of the week from that date? for example&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Date&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;week&lt;/P&gt;&lt;P&gt;1jun2018&amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;&lt;P&gt;2jun2018&amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;3jun2018&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;week starts on Sunday.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 15:24:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Customizing-a-fiscal-year/m-p/473042#M285852</guid>
      <dc:creator>jb9977</dc:creator>
      <dc:date>2018-06-25T15:24:39Z</dc:date>
    </item>
    <item>
      <title>Re: Customizing a fiscal year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Customizing-a-fiscal-year/m-p/473047#M285853</link>
      <description>&lt;P&gt;First, is your "date" a SAS date valued numeric or character?&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 15:32:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Customizing-a-fiscal-year/m-p/473047#M285853</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-06-25T15:32:39Z</dc:date>
    </item>
    <item>
      <title>Re: Customizing a fiscal year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Customizing-a-fiscal-year/m-p/473591#M285854</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
 do date='01jan2015'd to '01jul2018'd;
   fiscal_year=year(intnx('year.6',date,0,'b'));
   week=week(date-('01jun2018'd-'01jan2018'd),'v');
   output;
 end;
 format date date9.;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Jun 2018 03:41:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Customizing-a-fiscal-year/m-p/473591#M285854</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-06-27T03:41:01Z</dc:date>
    </item>
    <item>
      <title>Re: Customizing a fiscal year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Customizing-a-fiscal-year/m-p/473694#M285855</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Hmmm... Does your week calculation work 100% when it comes to leap years?&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jun 2018 12:35:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Customizing-a-fiscal-year/m-p/473694#M285855</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-06-27T12:35:51Z</dc:date>
    </item>
    <item>
      <title>Re: Customizing a fiscal year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Customizing-a-fiscal-year/m-p/473793#M285856</link>
      <description>&lt;P&gt;Fiscal years are typically assigned a name corresponding to the year including the majority of months.&amp;nbsp; So fiscal year June 2009-May 2010 is usually called FY2009.&amp;nbsp;&amp;nbsp; (July-June fiscal years, having 6 months in each calendar year, are commonly given an FY value corresponding to the year in which June falls - i.e.&amp;nbsp;&amp;nbsp; July 2009-June 2010 usually called FY2010).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS date functions support the use of fiscal years easily.&amp;nbsp; In your case the yearly interval is designated as "YEAR.6"&amp;nbsp; (years beginning in June).&amp;nbsp; To do you task, you need (1) to determine the first date of the fiscal year in which the date-in-hand falls (using the INTNX functions), then (2) count weeks (using INTCK):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set have;
   fybegin=intnx('year.6',date,0,'BEGIN');
   weeknum=1+intck('week',fybegin,date);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of course, the 'week'&amp;nbsp; (which is the same as week.1) counts weeks as starting with Sundays.&amp;nbsp;&amp;nbsp; If you need weeks starting with, say Mondays, use "week.2" as the interval measure in INTCK function.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jun 2018 15:48:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Customizing-a-fiscal-year/m-p/473793#M285856</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2018-06-27T15:48:58Z</dc:date>
    </item>
    <item>
      <title>Re: Customizing a fiscal year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Customizing-a-fiscal-year/m-p/473951#M285857</link>
      <description>&lt;P&gt;Patrick,&lt;/P&gt;
&lt;P&gt;I don't know. Can you post an example to explain it .&lt;/P&gt;
&lt;P&gt;If my code doesn't work. Data step come to rescue .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; by fiscal_year;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; if first.fiscal_year then do;n=0;week=0;end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; n+1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; if mod(n,7)=1 then week+1;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jun 2018 01:53:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Customizing-a-fiscal-year/m-p/473951#M285857</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-06-28T01:53:47Z</dc:date>
    </item>
  </channel>
</rss>

