LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (December 2006, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 7 Dec 2006 13:51:25 -0600
Reply-To:   Yu Zhang <zhangyu05@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Yu Zhang <zhangyu05@GMAIL.COM>
Subject:   Re: A question on getting first wednesday of the month
Comments:   To: MCI <330006@gmail.com>
In-Reply-To:   <1165519953.589999.38050@80g2000cwy.googlegroups.com>
Content-Type:   text/plain; charset=ISO-8859-1; format=flowed

MCI,

first, week.2 interval won't give you the first Wedn of the specified month. By default, Sunday will be the strating point. so Week.4 will return the Wednesday.

Here is a working sample:

data _null_; date='Mar99'; current_date=input('01'||date,date9.);

wed = INTNX( 'week.4',current_date,2 ); put wed date9.; run; you can put the date conversion statement into the INTNX function.

HTH

Yu

On 12/7/06, MCI <330006@gmail.com> wrote: > > Hi guys, just can't figure this out: > > Suppose I have 100 rows of data, rows are such as: > "MAR99", "MAR02", "DEC03", etc. > > How to convert for example, "MAR99" to the first wednesday > in March 1999, which is, "1999-03-03"? > > I think the following code can give the first wednesday of the same > month as current_date, which could be any day in March 1999, but > how do I convert "MAR99" to current_date? > > wed = INTNX( 'week.2', intnx('month', current_date, 0) - 1, 3) > > Thanks a lot, appreciate it! >


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