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 (January 2009, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 8 Jan 2009 15:27:38 -0600
Reply-To:   "./ ADD NAME=Data _null_," <iebupdte@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "./ ADD NAME=Data _null_," <iebupdte@GMAIL.COM>
Subject:   Re: Format Phone Number
Comments:   To: sdlenter <sdlentert@aol.com>
In-Reply-To:   <fe7128ad-f298-4c24-a048-44f522cd8b42@r32g2000vba.googlegroups.com>
Content-Type:   text/plain; charset=ISO-8859-1

I think perhaps the easiest way is to convert the phone number to a SAS numeric variable and use a PICTURE format. Something like...

proc format; picture tele 0-9999999 = '999-9999' other=' 999)999-9999' (prefix='('); run; data test; input tele; tele2 = tele; format tele tele.; cards; 1234567890 0001234567 ;;;; run; proc print; run;

On 1/8/09, sdlenter <sdlentert@aol.com> wrote: > In my sas dataset I have a variable called "phone" and it's in $10. > format and appears like this > 1234567890 > I need it to look like this > (123)-456-7890 > > Thanks >


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