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 (December 2004, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 14 Dec 2004 12:53:31 -0500
Reply-To:   harry.droogendyk@RBC.COM
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Harry Droogendyk <harry.droogendyk@RBC.COM>
Subject:   Re: How to get substr of integer data type
Content-Type:   text/plain; charset=iso-8859-1

As you've suggested, convert it to character using PUT. Numeric formats are automatically right-justified in the alloted width so 2 digit values will have a leading space.

data _null_; do i = 55, 86, 87, 185, 288, 386; if substr(put(i,3.),2,2) in ( '86', '87', '88', '89' ) then put i=; end; run;

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU]On Behalf Of Lu Liu Sent: Tuesday, December 14, 2004 12:48 PM To: SAS-L@LISTSERV.UGA.EDU Subject: How to get substr of integer data type


I have an integer column and data is always 3 digits. I want to get data from this field if the last two digits are 86, 87, 88 or 89. I know I can use SUBSTR, INDEX if the data type is character, but what function can I use for numeric data type? Or do I need to convert the value to character first?

Thank you very much for your help! Lu


This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately.

Ce courrier électronique est confidentiel et protégé. L'expéditeur ne renonce pas aux droits et obligations qui s'y rapportent. Toute diffusion, utilisation ou copie de ce message ou des renseignements qu'il contient par une personne autre que le (les) destinataire(s) désigné(s) est interdite. Si vous recevez ce courrier électronique par erreur, veuillez m'en aviser immédiatement, par retour de courrier électronique ou par un autre moyen.


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