LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (October 2003, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sat, 11 Oct 2003 22:29:43 -0400
Reply-To:     Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Subject:      Re: Fetch Hexadecimal digits from Character and Convert them to
              Number

Notice that the informat used is HEX, not $HEX (as speculated by MK). That's because the hex string represents a number. No format is involved. Also, there is just one conversion, not two.

Sometimes it helps to remember that hex is nothing more than a compact representation for binary values; anybody who remembers "core dumps" hundreds of pages thick should appreciate that. Hex has no other significance in computer architecture.

On Fri, 10 Oct 2003 10:40:22 -0700, shiling zhang <shiling99@YAHOO.COM> wrote:

>You are there. Here is the example in your case. > >If the variable values have variable length and last 4 digit is always >as you said, then you can reverse(reverse fuction in SAS) it and take >the first 4 digits and reverse it back. > >num=input(substr(xyz,10,4), hex4.); > >myquery5@yahoo.com (MK) wrote in message news:<266ac6c.0310100544.416afcb1@posting.google.com>... >> Hello, >> >> I have a dataset where a column(say First_Cell) has values like - >> 40497000A041D >> 40497001E14E9 >> 40497003C2399 etc.. >> >> These values are stored as CHARACTER type. The last 4 characters of >> the above string identify HEXADECIMAL number. >> I need to convert these last 4 characters to number. >> >> I think the path I need to follow is - >> 1)Fetch last 4 characters from the string >> 2) Convert them to HEXADECIMAL value >> 3)Convert the HEXADECIMAL to Number type. >> >> Is this approach right? If yes then should I use $HEXw. FORMAT & >> INFORMATS? How do I go about achieving this? >> >> Is there any other simpler and/or faster approach? >> >> Pls. help. >> >> Thanks >> M.K.


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