Date: Fri, 29 Feb 2008 15:02:32 -0500 Laurel A Copeland "SAS(r) Discussion" Laurel A Copeland Quarters for Fiscal Years text/plain; charset=ISO-8859-1

I need to determine quarters for a fiscal year with a negative offset of three months. Our fiscal year begins three months before the calendar year of the same name, so that FY2000 begins in October 1999. I have gotten as far as is shown below, but canâ€™t seem to get the adjustment for leap years right. I think it is leap years that are throwing the quarter off for certain end-of-quarter dates (see example below). I have many years of data to deal with. I would appreciate your suggestions! Thanks, Laurel Copeland San Antonio, Texas

*28FEB2008*extract FY QUARTER*; *a leap year problem*; *FY qtrs: 1=OND, 2=JFM, 3=AMJ, 4=JAS; data x; input id date date9. shouldbeq; cards; 100 30sep1999 4 101 01oct1999 1 101 02oct1999 1 101 30oct1999 1 102 31oct1999 1 103 30dec1999 1 103 31dec1999 1 104 01jan2000 2 105 30mar2000 2 105 31mar2000 2 106 01apr2000 3 107 30jun2000 3 107 01jul2000 4 108 01jul2002 4 108 02jul2002 4 109 29sep2003 4 109 30sep2003 4 110 01oct2003 1 111 30oct2003 1 111 31oct2003 1 111 01nov2003 1 112 31dec2003 1 ; run; proc print; format date date9.; run;

data y; set x; format date qstart date9.; qstart=intnx('year.10',date,0); fy=year(qstart) + 1; q=qtr(date-qstart); if shouldbeq NE q THEN flag='*'; run; proc print; run;

Back to: Top of message | Previous page | Main SAS-L page