Date: Mon, 25 Aug 2003 09:22:12 -0400
Reply-To: "Fehd, Ronald J. (PHPPO)" <rjf2@CDC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Fehd, Ronald J. (PHPPO)" <rjf2@CDC.GOV>
Subject: feature: when is a literal not a hex value?
Content-Type: text/plain; charset="iso-8859-1"
while working with Master HashMan Dorfman's
symput of a real number to a hex value
http://www.listserv.uga.edu/cgi-bin/wa?A2=ind0203D&L=sas-l&P=R13964
note: his example number is
113 data _null_ ;
114 n_int = 1234567.89012349 ;
115 call symput ('hrbn', put(put(n_int, rb8.),$hex16.)) ;
116 run ;
I came across the most interesting weirdness:
while trying to figure out how to quote the symput string.
DATA _Null_;
array nmbr (*) 8
Fraction X
( 0 3FD5555555555555x);
Fraction = 1/3;
array chr (*) $ 20
Qs Qd
('3FD5555555555555'x
"3FD5555555555555"x);
do I = 1 to dim(Nmbr);
put 'num ' Nmbr(I)= Nmbr(I) hex16.;
put 'char ' Chr(I) = Chr(I) hex16.;
end;
stop;
run;
log, aligned to highlight hex string
num FRACTION=0.3333333333 3FD5555555555555
char QS =?ÕUUUUUU 3FD5555555555555
num X =4.5996764E18 43CFEAAAAAAAAAAA
char QD =?ÕUUUUUU 3FD5555555555555
any reasonable explanation
as to why X is not equal to Fraction
will be thoroughly pondered.
Ron Fehd the macro maven CDC Atlanta GA USA RJF2@cdc.gov
remember perspective: the error is not always where it seems to occur! --
RJF2