Date: Thu, 28 Aug 2008 11:52:19 -0400
Reply-To: "Fehd, Ronald J. (CDC/CCHIS/NCPHI)" <rjf2@CDC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Fehd, Ronald J. (CDC/CCHIS/NCPHI)" <rjf2@CDC.GOV>
Subject: Re: Character values to month
In-Reply-To: <200808281534.m7SArhHS014015@malibu.cc.uga.edu>
Content-Type: text/plain; charset=us-ascii
> From: DP
>
> Can anyone please tell me how to convert a character value to
> month? For
> instance, convert '1' to Jan, '2' to Feb, '3' to Mar, etc...
> One thing I can think of is to create a format and then apply
> the format to
> the variable. Is there another efficient way of doing this?
you will have to use two function to do this
convert string to date-number: mdy('1','1','1960')
convert date-number to string put(number,monyy.)
untested
Do Txt = '1' to '9';
Mon3 = substr(put(mdy(Txt,'1','1960')
,monyy.)
,1,3);
end;
Ron Fehd the macro maven CDC Atlanta GA USA RJF2 at cdc dot gov
|