LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (September 2007, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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
Comments: To: Ran S <raan67@yahoo.com>
In-Reply-To:  <200709261301.l8QAmG87013485@mailgw.cc.uga.edu>
Content-Type: text/plain; charset="Windows-1252"

Ran ,

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. ) ;

Toby Dunn

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 > > Hi, > > 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 > > 1_1 > 17_2 > 188_3 > > > 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. > > > Thanks!

_________________________________________________________________ Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy! http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us


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