Date: Wed, 26 Sep 2007 13:20:21 +0000
Reply-To: toby dunn <tobydunn@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: toby dunn <tobydunn@HOTMAIL.COM>
Subject: Re: loosing zero numbers
Content-Type: text/plain; charset="Windows-1252"
Numerics in SAS have the leading zeros stripped. So you have to convert them to character and use the Z Format.
C = Put( A , Z3. -L ) || "_" || Put( B , Z4. -L ) ;
Better yet if you are using SASV9 use one of the Cat functions:
C = CatX( '_' , Put( A , Z3. ) , Put( B , Z4. ) ) ;
Your other questions answer is :
A = Put( , Z4. ) ;
Compromise is like telling a lie, it gets easier and easier. Each comprimise you make, that becomes your standard.
Perfection doesnt exist, once you reach it, its not perfect anymore. It means something else.
> Date: Wed, 26 Sep 2007 09:01:47 -0400
> From: raan67@YAHOO.COM
> Subject: loosing zero numbers
> To: SAS-L@LISTSERV.UGA.EDU
> I have dataset like:
> A B
> 001 0001
> 017 0002
> 188 0003
> Now I would like to concatenate A and B and I would like to keep zero’s I
> have in the beginning of each number.
> Such as I get 001_0001, 017_0002….
> But when I am doing that using this code C=A||’_’||B, I am loosing zeros
> and I am getting
> Second, I am also trying to create a new variable A (4 digits) and I would
> like to show this new variable as 0001,0017,0188. How can add ‘0’ in the
> beginning of each number.
> I tried to use the code: =”0”||A. But its not working.
Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy!