Date: Fri, 18 Feb 2005 16:57:17 -0800
Reply-To: "Chang, Ei-Wen" <Ei-Wen_Chang@CTB.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Chang, Ei-Wen" <Ei-Wen_Chang@CTB.COM>
Subject: Re: Convert ZIP into character and add missing zeroes infront
Content-Type: text/plain; charset="us-ascii"
Try this.
length nzip $5 zip 5;
nzip=translate( put(zip,$5.),'0',' ');
Ei-Wen
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Nick .
Sent: Monday, February 14, 2005 12:58 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Convert ZIP into character and add missing zeroes infront
Hello SAS experts,
I have ZIP codes in numeric form like 7001 (it's missing a zero infront
to make it a legitimate 5-digit zip code), 60073(has 5- digits, it's
fine), 1, etc. I would like to convert my numeric ZIPS into characters
and at the same time add leading zeroes to make them legitimate 5-digits
ZIPs. How do I do that? Thnaks much.
ZIP
7001
1
23
345
I would like ZIP to become a character variable like
ZIP
07001
00001
00023
00345
--
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm
|