Date: Tue, 7 Sep 2010 16:22:51 -0400
Reply-To: Mike Rhoads <RHOADSM1@WESTAT.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Mike Rhoads <RHOADSM1@WESTAT.COM>
Subject: Re: Extracting the Tuesday after the 3rd Friday
In-Reply-To: <8a990c33-d15a-4ce2-9171-47b36c188341@x42g2000yqx.googlegroups.com>
Content-Type: text/plain; charset="us-ascii"
If you're lucky enough to be running SAS 9.2, there's a new function specifically designed for identifying things like the 3rd Friday of a particular month:
NWKDOM -- returns the date for the nth occurrence of a weekday for the specified month and year
NWKDOM(3, 1, 6, 2010) returns 20JUN2010 (3rd Sunday, since Sunday is "day 1" of each week)
Value of 5 for 1st argument means last week of the month
Mike Rhoads
RhoadsM1@Westat.com
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Arthur Tabachneck
Sent: Tuesday, September 07, 2010 11:18 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: Extracting the Tuesday after the 3rd Friday
Rob,
I missed the part of your request that said you want to "extract"
those records which meet the condition. However, I'd still propose
the same calculation, just using it in a where statement. E.g.,:
data want;
set have;
format TradingDate weekdatx32.;
where TradingDate eq
/*3rd Friday of each month*/
intnx('week.6',
mdy(month(TradingDate),1,year(TradingDate))-1,3)
/*+4 to = following Tuesday*/ +4;
run;
HTH,
Art
------------
On Sep 6, 3:14 am, Rob Roszkowski <rob.roszkow...@gmail.com> wrote:
> Hi everyone,
>
> I am using daily time series data and I would like to extract those
> observations that lie on the Tuesday (after the 3rd Friday of the
> month). Does anyone know how to do this? From what I have researched
> so far, it looks like maybe date functions is a possible solution.
>
> Many Thanks in advance for any advice.
|