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 (April 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, 25 Apr 2007 12:06:36 -0400
Reply-To:     Jake Bee <johbee@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Jake Bee <johbee@GMAIL.COM>
Subject:      Re: A DATASET PROBLEM
Comments: To: Rathindronath <mehedisas@yahoo.com>
In-Reply-To:  <ed52c9100704250904i2086a7ebka93682abc9c9482a@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

correct lenght spelling to length -- sorry

On 4/25/07, Jake Bee <johbee@gmail.com> wrote: > > One way: > > data test; > input ids 8.; > lenght _subject_ $8 subject $2; > _subject_=compress(put(ids,8.)); > subject=substr(_subject_,(length(_subject_)-1)); > cards; > 201 > 301 > 201 > 10005 > 2368 > ; > run; > > proc print data=test; > run; > > > > On 4/25/07, Rathindronath <mehedisas@yahoo.com> wrote: > > > > I have two problems: > > --------------------- > > I have a numeric variable. I need the last two digit > > how can I get it using substr fuction: > > > > subject > > ------- > > 201 > > 301 > > 201 > > 10005 > > 2368 > > > > The result will be as below: > > > > subjet > > ------ > > 01 > > 01 > > 01 > > 05 > > 68 > > > > > > Also I have a following variable: > > > > Test > > ----- > > OUTA809 > > OUTA980 > > OUTA789 > > > > I need an output as below with adding a "0" in the middle of the > > value. So the output will be as below: > > > > > > Test > > ----- > > OUTA0809 > > OUTA0980 > > OUTA0789 > > > > > > Thanks you very much. > > > >


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