| Date: | Thu, 6 Jul 2006 17:15:47 -0400 |
| Reply-To: | "Sridhar, Kumar" <nsridhar@MEDAREX.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | "Sridhar, Kumar" <nsridhar@MEDAREX.COM> |
| Subject: | Re: [BULK] Strip leading zeros |
|
| Content-Type: | text/plain; charset=us-ascii |
Oops. Sorry I should've looked at what I didn't include:
data test;
input ptid $6.;
pid=input(ptid,6.);
newptid=put(pid,$5.);
cards;
000012
020093
004000
;
proc contents;
run;
HTH
Kumar
-----Original Message-----
From: Sridhar, Kumar
Sent: Thursday, July 06, 2006 5:13 PM
To: 'Andrew Kramer'; SAS-L@LISTSERV.UGA.EDU
Subject: RE: [BULK] Strip leading zeros
Andrew:
IMHO, the fastest way of doing this would be (and I think this
would be version-independent):
data test;
input ptid $6.;
pid=input(ptid,6.);
cards;
000012
020093
004000
;
proc print;
run;
Thanks and regards
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Andrew Kramer
Sent: Thursday, July 06, 2006 4:56 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: [BULK] Strip leading zeros
Importance: Low
I inherited a file that has an undesirable format for the patient ID
("PTID"). In essence PTID was derived from a numeric variable and
reformatted as $6. Unfortunately leading zeros were added to fill out
the
variable. I would like to strip away the leading zeros and leave the
rest
of the value. Here's some examples of what I'd like to do:
PTID newPTID
000012 12
020093 20093
004000 4000
I'm using version 9.1.3.
Thanks,
Andrew Kramer
|