I have been looking around for a way to digest and export SAS files using NodeJS. I guess it can be done by means of:
I couldn't find anything ready made on the Internet. I haven't tried to cook one up myself. I am not considering other options such as to get SAS to export CSVs. I assume that SAS is not available to NodeJS.
Does anyone know of any ready made way of making NodeJS to work with xport and sas7bdat files?
Regards, Vasilij
I just made this for sas7bdat files: https://github.com/dumbmatter/sas7bdat-js
It's a pure JS module for reading sas7bdat files in NodeJS. Install with:
npm install sas7bdat
Then load the module:
const SAS7BDAT = require('sas7bdat');
SAS7BDAT.createReadStream
returns a stream that emits individual rows, one at a time:
const stream = SAS7BDAT.createReadStream('test.sas7bdat');
stream.on('data', row => console.log(row));
stream.on('end', () => console.log('Done!'));
stream.on('error', err => console.log(err));
SAS7BDAT.parse
returns a promise that resolves to an array containing all the rows:
SAS7BDAT.parse('test.sas7bdat')
.then(rows => console.log(rows))
.catch(err => console.log(err));
hello, looks like it has and error on WIndows 10npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! fs-ext@2.0.0 install:
node-gyp configure build
npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the fs-ext@2.0.0 install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.Sorry I don't have Windows, but a PR is welcome if you figure out what the problem is :)