The dsread output is little-endian, as that's the native format for
floats on the Wintel platform. The byte order should stay the same if
converting directly to a float, using a data structure like (C/C++):
union {
char bytes[8];
double value;
}
If reading the values with a SAS HEX informat, the bytes will need to be
reversed. It's obviously trivial for me to add an endian-ness option,
I'll do that later....
Chris.
On 02/03/2010 02:06, Roger DeAngelis(xlr82sas) wrote:
> Hi,
>
> It looks like we may need to swap bytes(little endian to big endian). I
> will look into it tonight.
>
> As a side note, SAS reserves 28 floats for missing values. It should be
> easy to convert these to NaN on input to R.
>
> You can test this in SAS by converting the 16 char floats to ieee8. in SAS
> and doing a put. The result will be A, B...Z, . and _.
>
> SAS code that produced the listing is below.
>
> Here are the floats that map to the 28 missing values in SAS
>
> A FFFFFD0000000000
> B FFFFFC0000000000
> C FFFFFB0000000000
> D FFFFFA0000000000
> E FFFFF90000000000
> F FFFFF80000000000
> G FFFFF70000000000
> H FFFFF60000000000
> I FFFFF50000000000
> J FFFFF40000000000
> K FFFFF30000000000
> L FFFFF20000000000
> M FFFFF10000000000
> N FFFFF00000000000
> O FFFFEF0000000000
> P FFFFEE0000000000
> Q FFFFED0000000000
> R FFFFEC0000000000
> S FFFFEB0000000000
> T FFFFEA0000000000
> U FFFFE90000000000
> V FFFFE80000000000
> W FFFFE70000000000
> X FFFFE60000000000
> Y FFFFE50000000000
> Z FFFFE40000000000
> _ FFFFFF0000000000
> . FFFFFE0000000000
>
> data mis;
> retain A .A B .B C .C D .D E .E F .F G .G H .H I .I J .J K .K L .L M .M
> N .N O .O P .P Q .Q R .R S .S T .T U .U V .V W .W X .X Y .Y Z .Z
> _ ._ DOT .;
> array mis[28] A B C D E F G H I J K L M N O P Q R S T U V W X Y Z _ DOT;
> do idx=1 to 28;
> hex=put(mis[idx],ieee8.);
> xeh=put(hex,hex16.);
> put @1 mis[idx] @6 xeh;
> end;
>
>
>
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.