|
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
|