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 (February 1996, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 20 Feb 1996 23:22:03 -0800
Reply-To:     Andrew James Llwellyn Cary <ajlcary@IX.NETCOM.COM>
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         Andrew James Llwellyn Cary <ajlcary@IX.NETCOM.COM>
Organization: Cary Consulting Services
Subject:      Re: decoding binary representation of numeric fields

Tony Plate wrote: > > I have a SAS6.03(PC) file which I want to convert to ascii > (I don't have easy access to SAS). I know the field > locations, and can easily translate ascii fields. However, > the numeric fields have some bizzare encoding of integers > which I cannot decode (e.g., 0xf03f is 1, 0x0040 is 2, > 0x0840 is 3). Is there a simple method of translating the > contents of 8-byte numeric fields to integers? > > thanks, > > Tony Plate

SAS uses the IEEE format for all numeric values (both integer and real). These 8 byte (64 bit) numbers use the following structure:

bit 01 sign bit 02-12 normalized binary exponent msb->lsb but 12-64 binary mantissa msb->lsb

The BASIC interpreter Microsoft gave you (QBASIC) has a type DOUBLE which can be used to convert these values to ASCII.

AJL Cary

The normalized binary exponent effectively uses the high -- Andrew J. L. Cary | I Reckon that the Opinions Senior Curmudgeon | expressed here DO represent Cary Consulting Services, Newark, CA | those of the management of ajlcary@ix.netcom.com | Cary Consulting Services


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