<?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: Fiscal quarter and year in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Fiscal-quarter-and-year/m-p/60892#M7258</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Thanks. I will store those dataset with all date values in&amp;nbsp; a permanenet library. Good stuff.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 07 Sep 2011 13:30:52 GMT</pubDate>
    <dc:creator>Sanjay_M</dc:creator>
    <dc:date>2011-09-07T13:30:52Z</dc:date>
    <item>
      <title>Fiscal quarter and year</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Fiscal-quarter-and-year/m-p/60887#M7253</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How can I find out the UK fiscal quarter and year from SAS Date please?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please note the UK financial year starts from 6th April - 5th April next year&lt;/P&gt;&lt;P&gt;i.e. 6-Apr-01 to 05-Jul-01 is the first quarter of year 2001.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Sep 2011 12:52:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Fiscal-quarter-and-year/m-p/60887#M7253</guid>
      <dc:creator>Sanjay_M</dc:creator>
      <dc:date>2011-09-06T12:52:34Z</dc:date>
    </item>
    <item>
      <title>Re: Fiscal quarter and year</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Fiscal-quarter-and-year/m-p/60888#M7254</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't know if this what you're looking for but it may help you figure it out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; type:&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: teal; font-family: 'Courier New'; background-color: white;"&gt;$1.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; date:&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: teal; font-family: 'Courier New'; background-color: white;"&gt;date.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;&amp;nbsp;&amp;nbsp; fy0 = intnx(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: purple; font-family: 'Courier New'; background-color: white;"&gt;'year.4'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;,date,&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;0&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: purple; font-family: 'Courier New'; background-color: white;"&gt;'B'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;); &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: green; font-family: 'Courier New'; background-color: white;"&gt;*start date of fiscal year;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; fy $&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;9&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;&amp;nbsp;&amp;nbsp; fy&amp;nbsp;&amp;nbsp; = catx(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: purple; font-family: 'Courier New'; background-color: white;"&gt;'/'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;,year(fy0),year(fy0)+&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;&amp;nbsp;&amp;nbsp; fyQT = intck(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: purple; font-family: 'Courier New'; background-color: white;"&gt;'QTR'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;,fy0,date)+&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;format&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; date &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: teal; font-family: 'Courier New'; background-color: white;"&gt;date.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; fy0 &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: teal; font-family: 'Courier New'; background-color: white;"&gt;date.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: #ffffc0;"&gt;A 01oct08&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: #ffffc0;"&gt;A 01jan09&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: #ffffc0;"&gt;A 01apr09&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: #ffffc0;"&gt;A 01jul09&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: #ffffc0;"&gt;A 01oct09&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: #ffffc0;"&gt;B 10oct09&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: #ffffc0;"&gt;B 23jan10&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: #ffffc0;"&gt;B 14apr10&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: #ffffc0;"&gt;B 04jul10&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: #ffffc0;"&gt;B 16Oct10&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;;;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;print&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; type;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;id&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; type;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Sep 2011 15:25:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Fiscal-quarter-and-year/m-p/60888#M7254</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2011-09-06T15:25:37Z</dc:date>
    </item>
    <item>
      <title>Re: Fiscal quarter and year</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Fiscal-quarter-and-year/m-p/60889#M7255</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for forcing me to learn something new.&amp;nbsp; I wasn't even aware that SAS had this capability built in, but I think that the following example does exactly what you are looking for:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;options intervalds=(FiscalQuarter=FQDS);&lt;/P&gt;&lt;P&gt;data FQDS(keep=BEGIN SEASON);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; start = '06APR2009'D;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; stop&amp;nbsp; = '05APR2015'D;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; do BEGIN=start to stop;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; season=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if day(begin) eq 6 then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if month(begin) eq 4 then season=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if month(begin) eq 7 then season=2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if month(begin) eq 10 then season=3;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if month(begin) eq 1 then season=4;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if season gt 0 then output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; format BEGIN DATE.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format dates date9.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input dates date9.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; quarter=INTINDEX( 'fiscalquarter', dates );&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;14jan2011&lt;/P&gt;&lt;P&gt;5apr2011&lt;/P&gt;&lt;P&gt;6apr2011&lt;/P&gt;&lt;P&gt;5jul2011&lt;/P&gt;&lt;P&gt;6jul2011&lt;/P&gt;&lt;P&gt;14aug2011&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Sep 2011 15:40:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Fiscal-quarter-and-year/m-p/60889#M7255</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-09-06T15:40:00Z</dc:date>
    </item>
    <item>
      <title>Re: Fiscal quarter and year</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Fiscal-quarter-and-year/m-p/60890#M7256</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;﻿Hello art297,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your example in the first step you are running through a range of dates to find out the quarters first.&lt;/P&gt;&lt;P&gt;Does that mean that I have to do this for all the dates in my dataset?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;﻿&lt;/P&gt;&lt;P&gt;I've managed to write this code. I "think" it is right unless you point out some flaw &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data date_test; input dt1 ; format dt1 date9.; informat dt1 date9.; datalines; &lt;/P&gt;&lt;P&gt;"31Dec2001"d "01Jan2002"d "05Jan2002"d "06Jan2002"d "05Apr2002"d "06Apr2002"d "01May2002"d "05Jul2002"d "06Jul2002"d "01Aug2002"d "01Sep2002"d "05Oct2002"d "06Oct2002"d "01Nov2002"d "01Dec2002"d "31Dec2002"d "01Jan2003"d "05Jan2003"d "06Jan2003"d "06Feb2003"d "06Mar2003"d "05Apr2003"d "06Apr2003"d ; &lt;/P&gt;&lt;P&gt;run; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data a (keep=reportdate fiscal_qtr fiscal_year prevyear curryear a); set date_test; reportdate=dt1; format reportdate date9. q1_start_date date9. q1_end_date date9. q2_start_date date9. q2_end_date date9. q3_start_date date9. q3_end_date date9. q4_start_date date9. q4_end_date date9. ; if reportdate &amp;gt;= input('06APR'||put(year(reportdate), 4.), date9.) then do; prevyear = put(year(reportdate) , 4.); curryear = put(year(reportdate) + 1, 4.); end; else do; prevyear = put(year(reportdate) - 1, 4.); curryear = put(year(reportdate), 4.); end; if reportdate &amp;gt;= input('01JAN'||put(year(reportdate), 4.), date9.) and&amp;nbsp;&amp;nbsp; reportdate &amp;lt;= input('05APR'||put(year(reportdate), 4.), date9.) then&amp;nbsp;&amp;nbsp; fiscal_year=year(reportdate) - 1; else fiscal_year=year(reportdate); q1_start_date = input('06APR'||prevyear, date9.); q1_end_date = input('05JUL'||prevyear, date9.); q2_start_date = input('06JUL'||prevyear, date9.); q2_end_date = input('05OCT'||prevyear, date9.); q3_start_date = input('06OCT'||prevyear, date9.); q3_end_date = input('05JAN'||curryear, date9.); q4_start_date = input('06JAN'||curryear, date9.); q4_end_date = input('05APR'||curryear, date9.); if reportdate &amp;gt;= q1_start_date and reportdate &amp;lt;= q1_end_date then do; fiscal_qtr = 1; end; else if reportdate &amp;gt;= q2_start_date and reportdate &amp;lt;= q2_end_date then do; fiscal_qtr = 2; end; else if reportdate &amp;gt;= q3_start_date and reportdate &amp;lt;= q3_end_date then do; fiscal_qtr = 3; end; else if reportdate &amp;gt;= q4_start_date and reportdate &amp;lt;= q4_end_date then do; fiscal_qtr = 4; end; &lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any easier way please.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Sep 2011 08:15:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Fiscal-quarter-and-year/m-p/60890#M7256</guid>
      <dc:creator>Sanjay_M</dc:creator>
      <dc:date>2011-09-07T08:15:00Z</dc:date>
    </item>
    <item>
      <title>Re: Fiscal quarter and year</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Fiscal-quarter-and-year/m-p/60891#M7257</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I may or may not understand what you are trying to do.&amp;nbsp; In your code you try to KEEP a variable called "A", but no such variable is ever created.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then you set two variables to the same values, namely prevyear and fiscal_year.&amp;nbsp; Do you need both?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you elect to use the method I suggested, based on what I THINK you are trying to do, you would only have to include the range of dates once, store the interval datasets in a catalog, and include the option in your config file.&amp;nbsp; That process is described in the SAS documentation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Creating the following two files would suffice for all years between 1800 and 3000:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;options intervalds=(FiscalQuarter=FQDS&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FiscalYear=FYDS);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data FQDS(keep=BEGIN SEASON);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; start = '06APR1800'D;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; stop&amp;nbsp; = '05APR3000'D;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; do BEGIN=start to stop;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; season=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if day(begin) eq 6 then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if month(begin) eq 4 then season=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if month(begin) eq 7 then season=2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if month(begin) eq 10 then season=3;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if month(begin) eq 1 then season=4;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if season gt 0 then output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; format BEGIN DATE.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data FYDS(keep=BEGIN SEASON);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; start = '06APR1800'D;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; stop&amp;nbsp; = '05APR3000'D;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; do BEGIN=start to stop;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if day(begin) eq 6 and month(begin) eq 4 then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; season=year(begin);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; format BEGIN DATE.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, to achieve the same result as you did with your code, only the following would be needed:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data a;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set date_test (rename=(dt1=reportdate));&lt;/P&gt;&lt;P&gt;&amp;nbsp; prevyearyear=INTINDEX( 'fiscalyear', reportdate );&lt;/P&gt;&lt;P&gt;&amp;nbsp; curryear=INTINDEX( 'fiscalyear', reportdate )+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; fiscal_year=INTINDEX( 'fiscalyear', reportdate );&lt;/P&gt;&lt;P&gt;&amp;nbsp; fiscal_qtr=INTINDEX( 'fiscalquarter', reportdate );&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH,&lt;/P&gt;&lt;P&gt;Art&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Sep 2011 13:22:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Fiscal-quarter-and-year/m-p/60891#M7257</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-09-07T13:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: Fiscal quarter and year</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Fiscal-quarter-and-year/m-p/60892#M7258</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Thanks. I will store those dataset with all date values in&amp;nbsp; a permanenet library. Good stuff.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Sep 2011 13:30:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Fiscal-quarter-and-year/m-p/60892#M7258</guid>
      <dc:creator>Sanjay_M</dc:creator>
      <dc:date>2011-09-07T13:30:52Z</dc:date>
    </item>
    <item>
      <title>Re: Fiscal quarter and year</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Fiscal-quarter-and-year/m-p/60893#M7259</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I know this is an old post but I found it in my efforts to do some state fiscal year stuff.&amp;nbsp; I tried the above programs that were posted and I found them difficult and cumbersome.&amp;nbsp; I ended up scrapping them and came up with the above.&amp;nbsp; This would be for fiscal years that run July 1 to June 30 but could be easily adapted to the start and stop dates that you need. Just wanted to put this out there for other users.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;data &lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;work.appointments (&lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;drop&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;=appt_year appt_month);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;set&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; WORK.QUERY_FOR_APPOINTMENTS ;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;format&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; appt_date &lt;/SPAN&gt;&lt;SPAN style="background: white; color: teal; font-family: 'Courier New';"&gt;date9.&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; appt&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;_date = datepart(appointment_date);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp; appt_year = year(appt_date);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp; appt_month = month(appt_date);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;if&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; appt_month ge &lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;7&lt;/STRONG&gt; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;then&lt;/SPAN&gt; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;do&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sfy = appt_year+&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; appt_month in (&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;7&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;,&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;8&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;,&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;9&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;) &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;then&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; qtr = &lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;else&lt;/SPAN&gt; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;if&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; appt_month in (&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;10&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;,&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;11&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;,&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;12&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;) &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;then&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; qtr = &lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;2&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;end&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;else&lt;/SPAN&gt; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;if&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; appt_month le &lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;6&lt;/STRONG&gt; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;then&lt;/SPAN&gt; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;do&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sfy = appt_year;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;if&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; appt_month in (&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;,&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;2&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;,&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;3&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;) &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;then&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; qtr = &lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;3&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;else&lt;/SPAN&gt; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;if&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; appt_month in (&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;4&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;,&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;5&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;,&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;6&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;) &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;then&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; qtr = &lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;4&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;end&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Apr 2014 18:39:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Fiscal-quarter-and-year/m-p/60893#M7259</guid>
      <dc:creator>miriamm</dc:creator>
      <dc:date>2014-04-11T18:39:00Z</dc:date>
    </item>
    <item>
      <title>Re: Fiscal quarter and year</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Fiscal-quarter-and-year/m-p/300640#M16988</link>
      <description>&lt;P&gt;This looks quite complicated for a beginner, I have two variables like &amp;nbsp;the&amp;nbsp;month (in numbers 1-12) and year (2004 -2015) &amp;nbsp;and I want to define my fiscal year starting from July and ending in&amp;nbsp;June. Kindly write some codes for me thanks. like for 2004 start from 07(month) 2004 (year) and ends in 06(month) 2005(year) and so on. thanks&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 25 Sep 2016 18:42:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Fiscal-quarter-and-year/m-p/300640#M16988</guid>
      <dc:creator>raqthesolid</dc:creator>
      <dc:date>2016-09-25T18:42:41Z</dc:date>
    </item>
  </channel>
</rss>

