|
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
Hi,
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.
============================================================
|