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 (October 1996, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 8 Oct 1996 14:59:15 EDT
Reply-To:     V1354G@VM.TEMPLE.EDU
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         Ekeho Oh <V1354G@VM.TEMPLE.EDU>
Comments: To: sas-l%uga.BITNET@VM.TEMPLE.EDU

/* I hope u got an idea */ options nocenter; data t1; input v1 $8.; v2=substr(right(v1),6,3); q1=int(v2/100); q2=int(mod(v2,100)/10); q3=mod(v2,10); cards; 12344 22312 343123 123123 44312512 153 ; proc print; run; ---------- From: Ling Ting Subject: Help: extracting the last 3 digits of a Date: Tuesday, September 24, 1996 2:32PM

Hi,

Is there any one could give me a hint to create 3 new variables, and the values are extracted from the last 3 digits of a variable?

Example:

A -- > Q1 Q2 Q3

12344 -- > 3 4 4 22312 -- > 3 1 2 343123 -- > 1 2 3 123123 -- > 1 2 3 44312512 -- > 5 1 2 153 -- > 1 5 3 . more data .

what I need is to extract the last 3 digits and return them back to 3 differnt numeric variable Q1, Q2, and Q3. Function SUBSTR could be used to extact from first x digits as I know, but I need to extract last 3 digits (or say last x digits).

I appreciate any help/hint. TIA.

Ling

_\|||/_ /(. .)\ | L | \=/ ____________oOo---oOo__________ | | | Ling Ting | | University of Arkansas | | Computing Services | | (501) 575-2905 | | | |_____________________________| __|| ||__ /___| |___\


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