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 (October 2000, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 16 Oct 2000 12:41:49 -0500
Reply-To:     Jonathan_Goldberg@MASTERCARD.COM
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Jonathan Goldberg <Jonathan_Goldberg@MASTERCARD.COM>
Subject:      Re: macro DESPERATELY needed
Comments: cc: pjshon@HOTMAIL.COM
Content-type: text/plain; charset=us-ascii

The inevitable one-liner:

nfyr = input(fyr, 2.); /*assuming fyr is character '01', otherwise unnecessary*/ year = year(date); month = month(date); year = year - /*the rest subtracts 1 from year under the proper circumstances*/ ( /*0 otherwise) */ ((nfyr < 10) * (month <= (nfyr + 3))) + /*the first 9 months*/ ((nfyr => 10) * ((month - 1) <= mod(mfyr + 3, 13))) /*cycles are in sync after that*/ ); /*as long as month goes from 0-11*/ /*and the year is displaced appropriately*/ Jonathan

On Sun, Oct 15, 2000 at 10:39:37AM -0400, John (pjshon@HOTMAIL.COM) wrote: > i understand if you do not want to help with this one. my friend (ok, me) > needs help with the following code because he is SURE there is an easier > way. (it's LOOOONG.) this is stock market data. there are basically > 12 "fyr" fiscal-year-end values, 1 through 12, corresponding with each > month of the year. for the first "do" statement, it reads: if the fiscal > year is january (fyr=01) then returns that fall in the time period between > may 1971 and april 1972 should be assigned year=1972. if the returns fall > in the time period... etc etc. and then it's repeated for each fyr value, > with changes in the month/year parameters for each fyr. > > PLEASE PLEASE HELP!!! thank you... > data b; > set merg1; > > if fyr=3 then do; > if '01may71'd=<date=<'30apr72'd then year= 1971;


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