LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (February 2008, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 29 Feb 2008 12:12:54 -0800
Reply-To:     "Terjeson, Mark" <Mterjeson@RUSSELL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Terjeson, Mark" <Mterjeson@RUSSELL.COM>
Subject:      Re: Quarters for Fiscal Years
Comments: To: Laurel A Copeland <copelandl@UTHSCSA.EDU>
In-Reply-To:  A<200802292002.m1THUqBM002719@mailgw.cc.uga.edu>
Content-Type: text/plain; charset="UTF-8"

Hi Laurel,

Does this work better?

data x; input id date date9. shouldbeq; format date date9.; 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;

data y; set x; qstart = intnx('qtr',date,-3); format qstart date9.; q=qtr(qstart); if shouldbeq NE q THEN flag='*'; run;

Hope this is helpful.

Mark Terjeson Senior Programmer Analyst, IM&R Russell Investments

Russell Investments Global Leaders in Multi-Manager Investing

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Laurel A Copeland Sent: Friday, February 29, 2008 12:03 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Quarters for Fiscal Years

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