[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sas-l
Subject:    Re: How to keep last date of each fiscal QTR (not Calendar QTR)?
From:       Bolotin Yevgeniy <YBolotin () SCHOOLS ! NYC ! GOV>
Date:       2014-01-31 22:31:20
Message-ID: 54F43B75D0EA54498FD0970FEE0FE1A71FE363 () PXCHDAG4CHM06 ! nyced ! org
[Download RAW message or body]

This might be a dumb question, but why not just hardcode it?

Data WANT;
Set HAVE;
Where month(date) in (1,4,7,10);
Run;

-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Miris Fernando
Sent: Friday, January 31, 2014 4:50 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: How to keep last date of each fiscal QTR (not Calendar QTR)?

Hi SAS Forum;

/*I have this data set which comprises month end dates in consecutive months*/

data have;
informat date MMDDYY10.;
format date MMDDYY10.;
input date ;
cards;
03/31/2012
04/30/2012 /*want */
05/31/2012
06/30/2012
07/31/2012 /*want*/
08/31/2012
09/30/2012
10/31/2012 /*want*/
11/30/2012
12/31/2012
01/31/2013 /*want*/
02/28/2013
03/31/2013
04/30/2013 /*want*/
05/31/2013
;
Run;


/*Q: I wanted to keep only the last date of each fiscal quater (not calendar quater) \
Fiscal QTRs are: Nov to Jan is QTR1
Feb to Apr is QTR2
May to Jul is QTR3
Aug to Oct is QTR4

So, the final data set should be like this
04/30/2012
07/31/2012
10/31/2012
01/31/2013
04/30/2013

*/

/*I tried below few things but seems I am going no where*/


Data want;
Set have;
QTR_number = QTR(date); /*QTR function was used to give the number of Calendar QTR*/ \
date_1=put(date,MMDDYYN8.); /*converted the SAS date to a character var*/ \
date_2=input(date_1,8.); /*reconverting */ combine=mod(date_2,100); /*mode function \
was used to keep the remainder*/ joined=cats(combine,qtr_number); Run;

Could anyone help me?
Miris


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic