Date: Sun, 25 Nov 2007 22:24:05 -0500
Reply-To: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject: Re: Proc Format Error
Content-Type: text/plain; charset=ISO-8859-1
My understanding ...
The conventions used by SAS for storing double-precision numeric values were
not invented by SAS. They are platform-specific and are supported by the
hardware arithmetic instruction set on each platform. That is a major reason
why native SAS data sets cannot simply be ported from one platform to another.
Character (byte string) variables are in essence generic in purpose. They
can express text (in natural or other languages), category, order,
relationship, count, quantity, ... It's a matter of convention.
There are many different conventions for representing numeric information in
character variables. SAS provides informats to support extraction.
SAS has to be told (explicitly or implicitly) whether a variable is
character or numeric; the binary content does not determine type. Consider
the special situation of RB8. (here platform=Windows):
data demo;
value_n = 123.456;
value_c = reverse(put(value_n,rb8.) );
put value_n= hex16.;
put value_c= $hex16.;
The log shows:
value_n=405EDD2F1A9FBE77
value_c=405EDD2F1A9FBE77
So the two variables have the same content, but one is numeric and the other
is character. So this
value_n = value_n + 0;
runs with no problem whereas this
value_c = value_c + 0;
blows up (NOTE: Invalid numeric data, value_c='@^Ý/.Ÿ¾w')
run;