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 (January 2003, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 15 Jan 2003 12:04:54 -0800
Reply-To:     "William W. Viergever" <wwvierg@ATTGLOBAL.NET>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "William W. Viergever" <wwvierg@ATTGLOBAL.NET>
Subject:      Re: find the 3rd wednesday of every month
Comments: To: Lonnie Hamm <lonniehamm@hotmail.com>
In-Reply-To:  <ykhV9.53$iw.88820@news.uswest.net>
Content-Type: text/html; charset="us-ascii"

<html> At 10:59 AM 1/15/2003 -0700, Lonnie Hamm wrote:<br><br> <blockquote type=cite class=cite cite>Anyone know of an easy way to find the date associated with the 3rd<br> wednesday of every month?<br><br> In addition, I need to find the 2nd observation previous to the above date.<br> I suppose I could use proc expand to lead an indicator variable based on the<br> above date or perhaps using indicator variables in a data step with the<br> observations sorted in reverse order.<br><br> Lonnie</blockquote><br><br> Maybe something like:<br><br> <font color="#0000FF">%let</font> mon = 1 ;<br> <font color="#0000FF">%let</font> yr = 2003 ;<br> <font color="#000080"><b>data</b></font> <font color="#0000FF">_null_</font>;<br> &nbsp;&nbsp; <font color="#0000FF">do</font> i = mdy ( &amp;mon, <font color="#008080"><b>1</b></font>, &amp;yr ) <font color="#0000FF">to</font> intnx ( <font color="#800080">'month'</font>, mdy ( &amp;mon, <font color="#008080"><b>1</b></font>, &amp;yr ), <font color="#008080"><b>0</b></font>, <font color="#800080">'E'</font> );<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dow = weekday ( i ) ;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#0000FF">if</font> dow = <font color="#008080"><b>4</b></font> <font color="#0000FF">then</font> wed_flag + <font color="#008080"><b>1</b></font> ;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#0000FF">if</font> wed_flag = <font color="#008080"><b>3</b></font> <font color="#0000FF">then</font> <font color="#0000FF">do</font> ;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wed3 = i ;<br> <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab> <font color="#0000FF">leave</font> ;<br> <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp; <font color="#0000FF">end</font> ;<br> &nbsp;&nbsp; <font color="#0000FF">end</font> ;<br> &nbsp;&nbsp; <font color="#0000FF">put</font> wed3= <font color="#008080">weekdatx.</font> ;<br> <font color="#000080"><b>run</b></font> ;<br> <br> <div>------------------------------------------------------------</div> <div>William W. Viergever&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Voice&nbsp; : (916) 483-8398</div> <div>Viergever &amp; Associates&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Fax&nbsp;&nbsp;&nbsp; : (916) 486-1488</div> <div>Sacramento, CA 95825&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; E-mail : wwvierg@attglobal.net</div> <div>------------------------------------------------------------</div> <br> </html>


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