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 1999, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 17 Sep 1999 08:08:45 +0200
Reply-To:     F a b r i z i o <Fabrizio1@USA.NET>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         F a b r i z i o <Fabrizio1@USA.NET>
Organization: KLM Royal Dutch Airlines
Subject:      Re: Character Insertion

Jeff Gropp wrote in message ... >Yep, it's me again. >I have a character variable, X, (already in a sas data set) and I want to >place a zero in front of each value of X. That is, if X = 789 (these #'s >have been read as characters), I want X to equal 0789. >Thanks,

That's an easy one, as long as each of your values still has at least 1 'empty' byte at the end of its value.

Just code: X = '0' || X;

If, however, you have values for X which are filled completely, you first have to declare X in your datastep with a new length.

Assume your current X has maximum length 5, you might code:

DATA xxx; LENGTH X $6; SET xxx; X = '0' || X; RUN;

Brgds; Fabrizio


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