Category Archives: Technical

More sas7bdat progress

The development version of the read.sas7bdat function (in the sas7bdat package) now reads field labels and formats. In addition, errors of the type "found <x> <type> subheaders where 1 expected" are now a thing of the past. These improvements are largely due to work by Clint Cummins. The function also works on some files generated by 64 bit builds of SAS for Windows. Of 280 test files, the read.sas7bdat function works for all but 6, and these were generated on a Linux platform. Here is a preview of the sas7bdat package, version 0.2: sas7bdat_0.2.tar.gz

For those interested in C programming, it appears that the sas7bdat header corresponds to a C structure. There is evidence for this because the header fields are aligned at 4 byte boundaries when the file was written by SAS for 32 bit platforms, but 8 byte aligned for 64bit platforms. In addition, C structures are often padded with extra bytes by the compiler so that the entire structure is aligned to some multiple of the virtual memory page size. The overall length of the sas7bdat header differs from Windows to non-Windows platforms. This would make it difficult for the Windows version of SAS to read files written by the Linux version of SAS.

Does anyone know whether SAS can read sas7bdat datasets independent of the platform where the file was written? For example, is it possible using SAS for 32 bit Windows to read a file written by SAS for 64 bit Windows?