LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (August 2004, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 3 Aug 2004 15:53:13 -0400
Reply-To:   Lex Jansen <spam@LEXJANSEN.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Lex Jansen <spam@LEXJANSEN.COM>
Subject:   Re: convert months 'OCT' --> 10

data _null_; mon="nov";

mon1=int((((index("JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC",upcase(mon)))-1)/3) +1); put _all_; run;

Lex Jansen

"DePuy, Venita" <depuy001@DCRI.DUKE.EDU> wrote in message news:A7D4140CA0A3D24CA55F8A4495F1B25106069E0C@argon.dcri.duke.edu... > Hi all - > not having any luck finding a concise way to change months (JAN, FEB, MAR) > to numbers (1,2,3). > > What I have is month, day, year in 3 fields. So OCT, 15, 2003. (character, > numeric, numeric). > I'm wanting to change the OCT to 10 so I can use the MDY function to create > a date out of it. > > The only method I've come up with (in spite of searching Online Docs & > online in general) is a series of if/then statements . . if mon='JAN' then > mon1=1; else if mon='FEB' then mon1=2; . . etc. > > Any thoughts? > Either on a concise way to change months, or an equivalent function for MDY > that would take a 3-letter character variable for the month? > > Thanks much! > -Venita > Venita DePuy > Statistician II, Center for Clinical and Genetic Economics > Duke Clinical Research Institute > (919) 668-8087 > venita.depuy@duke.edu


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