pspp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: deciphering sas data files


From: Ben Pfaff
Subject: Re: deciphering sas data files
Date: Mon, 19 May 2008 17:59:36 -0700
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

Jason Stover <address@hidden> writes:

> I have a collection of small SAS data sets that I have been using to
> try to decipher the SAS data file format. I made some progress and
> have reached a more difficult task of figuring out how the actual
> numeric values are encoded.

I made a little headway on that fairly quickly.  We can use Perl
to see how numeric values are encoded as IEEE doubles, e.g.:

    address@hidden:~(0)$ perl -e 'print pack("d", 8.0)' | hd
    00000000  00 00 00 00 00 00 20 40                           |...... @|
    00000008
    address@hidden:~(0)$ perl -e 'print pack("d", 9.0)' | hd
    00000000  00 00 00 00 00 00 22 40                           |......"@|
    00000008
    address@hidden:~(0)$ 

Then, we can dump the differences between files that are supposed
to contain those values and look for them:

    address@hidden:~/tmp/sas(0)$ diff -u <(hd n_cases_1_float_9_lc_a.sas7bdat) 
<(hd n_cases_1_float_8_lc_a.sas7bdat) |grep '22 40\|20 40'
    -00000490  00 00 00 00 00 00 22 40  61 20 20 20 20 20 20 20  |......"@a     
  |
    +00000490  00 00 00 00 00 00 20 40  61 20 20 20 20 20 20 20  |...... @a     
  |

There are other differences between these files but those really
stick out.
-- 
"Then, I came to my senses, and slunk away, hoping no one overheard my
 thinking."
--Steve McAndrewSmith in the Monastery




reply via email to

[Prev in Thread] Current Thread [Next in Thread]