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 09:12:50 -0400
Reply-To:     "Sridhar, Nagakumar" <nagakumar.sridhar@SPCORP.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Sridhar, Nagakumar" <nagakumar.sridhar@SPCORP.COM>
Subject:      Re: loosing zero numbers
Comments: To: Ran S <raan67@YAHOO.COM>
In-Reply-To:  A<200709261301.l8QAmG87013485@mailgw.cc.uga.edu>
Content-Type: text/plain; charset="utf-8"

Ran: Is this what you're looking for?

data have; length c $8. newvar 4.; format newvar z4.; input a $3. b $4.; c=a||'_'||b; newvar=a; cards; 0010001 0170002 1880003 ; run;

proc print; run;

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Ran S Sent: Wednesday, September 26, 2007 9:02 AM To: SAS-L@LISTSERV.UGA.EDU Subject: loosing zero numbers

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! ********************************************************************* This message and any attachments are solely for the intended recipient. If you are not the intended recipient, disclosure, copying, use or distribution of the information included in this message is prohibited -- Please immediately and permanently delete.


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