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 (February 2008, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 5 Feb 2008 15:34:46 -0800
Reply-To:     pchoate <paulchoate61@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         pchoate <paulchoate61@GMAIL.COM>
Organization: http://groups.google.com
Subject:      Re: subset data by value of last 3 digits of a variable
Comments: To: sas-l@uga.edu
Content-Type: text/plain; charset=ISO-8859-1

I was thinking about the same as Nat - except the colon modifier (truncated comparison) works nicely here...

if left(reverse(prod)) =:'FIL';

hth

Paul Choate

On Feb 5, 2:09 pm, Nathaniel.Wood...@DOM.COM (Nat Wooding) wrote: > Length tells you the length ot the string.. Rather than > > if (substr(prod,length(prod-1),3)='LIF'; > > I suggest > > if (substr( cats( Reverse( prod) ,1 ,3))) ='FIL'; > > Nat Wooding > Environmental Specialist III > Dominion, Environmental Biology > 4111 Castlewood Rd > Richmond, VA 23234 > Phone:804-271-5313, Fax: 804-271-2977 > > Little T > <xiao.chacha@GMAI > L.COM> To > Sent by: "SAS(r) SA...@LISTSERV.UGA.EDU > Discussion" cc > <SA...@LISTSERV.U > GA.EDU> Subject > subsetdatabyvalueoflast3 > digitsof avariable > 02/05/2008 05:01 > PM > > Please respond to > Little T > <xiao.chacha@GMAI > L.COM> > > Hi, I need to create asubsetdatafor "Life" customer. Thevariablecan > identify these customer is {last-3-digit of prod}='LIF'. > > Can I used length(prod)-1 as below to get mydata? What exactly does > length(variable-1) do? > > Thanks everyone. > > datalife; > set whole_data; > if (substr(prod,length(prod-1),3)='LIF'; > run; > > ----------------------------------------- > CONFIDENTIALITY NOTICE: This electronic message contains > information which may be legally confidential and/or privileged and > does not in any case represent a firm ENERGY COMMODITY bid or offer > relating thereto which binds the sender without an additional > express written confirmation to that effect. The information is > intended solely for the individual or entity named above and access > by anyone else is unauthorized. If you are not the intended > recipient, any disclosure, copying, distribution, or use of the > contents of this information is prohibited and may be unlawful. If > you have received this electronic transmission in error, please > reply immediately to the sender that you have received the message > in error, and delete it. Thank you.


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