Site icon R-bloggers

More sas7bdat progress

[This article was first published on BioStatMatt » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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?

To leave a comment for the author, please follow the link and comment on their blog: BioStatMatt » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.