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
|