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