```Date: Tue, 7 Sep 2010 16:40:08 -0400 Reply-To: Arthur Tabachneck Sender: "SAS(r) Discussion" From: Arthur Tabachneck Subject: Re: Extracting the Tuesday after the 3rd Friday Comments: To: Mike Rhoads Mike, Mike, Thanks! I didn't know about that function. I can't test it as I don't have 9.2, but will it take functions and variables? I.e., in the case of the OP, could he use?: data want; set have; format TradingDate weekdatx32.; where TradingDate eq NWKDOM(3, 6, month(TradingDate),year(TradingDate)) + 4; run; Art ---------- On Tue, 7 Sep 2010 16:22:51 -0400, Mike Rhoads wrote: >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 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. ```

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