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 (May 2009, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 15 May 2009 11:13:45 -0400
Reply-To:     msz03@albany.edu
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Mike Zdeb <msz03@ALBANY.EDU>
Subject:      Re: Delete last 5 characters of a variables
Content-Type: text/plain;charset=iso-8859-1

hi ... OK, let's beat this to death ...

* won't work with the LEFT function used in the same statement as the concatenation and I'll never understand why ;

data x; set sashelp.class; name = " " || right(name); name = left(name); run;

proc print data=x; var name; run;

and ...

data test; te = "what shall we do with a drunken sailor "; te = " " || right(te); te = left(te); run;

proc print data=test; run;

-- Mike Zdeb U@Albany School of Public Health One University Place Rensselaer, New York 12144-3456 P/518-402-6479 F/630-604-1475

> you can use this, but therer are other solutions possible. > I used a lot the output statement so you can see what happens with the > string ... > > data test; > format te $50.; > te = "what shall we do with a drunken sailor "; > output; > te = trim(left(reverse(te))); > output; > te = substr(te,6,length(te)-5); > output; > te = trim(left(reverse(te))); > output; > run; > > regards, > > Mark > > On May 15, 4:14 pm, ash007 <RamsamyAsh...@gmail.com> wrote: >> hi, >> >> how to delete the last 5 characters of a variable alpha. >> >> thanks. >


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