stata-parser
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

Stata Parser

NodeJS module to read and write Stata files

It depends on jansson-dev. A static copy is available as part of the repository.

You can also install it directly using npm.

var js = require("jstata");
var stata_file = js.stataRead('filename.dta');
console.log(stata_file);

var exportData = {
  data: [
    ['hi',1],
    ['wee',2]
  ],
  metadata: {
      timestamp: '21 Oct 2015 23:26',
      observations: 2,
      variables: 2,
      datalabel: 'JStata',
      version: 10,
      nlabels: 1,
  },
  variables: [
    {
      vfmt: '%3s',
      name: 'message',
      dlabels: 'message variable',
      vlabels: '',
      valueType: 3
    },
    {
      vfmt: '%9.0g',
      name: 'number',
      dlabels: 'number variable',
      vlabels: 'TYesNo',
      valueType: 253
    }
  ],
  labels:{
    'TYesNo': [
        [1, 'Yes'],
        [2, 'No' ]
      ]
  }

}; 


js.stataWrite('export.dta', exportData);

/stata-parser/

    Package Sidebar

    Install

    npm i stata-parser

    Weekly Downloads

    2

    Version

    2.0.1

    License

    GPL-2.0-or-later

    Unpacked Size

    82.5 kB

    Total Files

    17

    Last publish

    Collaborators

    • rwesty