UNPKG

@wbg-mde/r-factory

Version:

Metadata editor R integration module

58 lines (50 loc) 2.25 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class ExportFileTemplates { static get stataDictionaryTemplate() { return stataDictionaryTemplate; } static get spssSyntaxTemplate() { return spssSyntaxTemplate; } static get stataDoFileTemplate() { return stataDoFileTemplate; } } exports.ExportFileTemplates = ExportFileTemplates; var stataDictionaryTemplate = `infile dictionary { {{#variables}} {{fn-startcolumn startColumn 14}}{{fn-padcolumn dataType 11}}{{fn-padcolumn name 36}}{{fn-padcolumn format 10}} "{{{labl}}}"{{/variables}} }`; var stataDoFileTemplate = `/* This Stata program was automatically generated by Metadata Editor */ /* The following line should contain the complete path and name of your raw data file */ /* Change the paths here to match the location of the files on your computer */ local dat_name "{{filePath}}" /* The following line should contain the path to your output '.dta' file */ /* Change the paths here to match the location of the files on your computer */ local dta_name "{{outPath}}" /* The following line should contain the path to the data dictionary file */ /* Change the paths here to match the location of the files on your computer */ local dct_name "{{dicPath}}" infile using "\`dct_name'", using("\`dat_name'") clear #delimit ;{{#valueLabelled}}{{#variables}}{{#isValueLablled}} label define {{name}}{{#labelledValues}} {{fn-padcolumn catValu 3}} "{{{labl}}}"{{/labelledValues}}; {{/isValueLablled}} {{/variables}} {{#variables}}{{#isValueLablled}} label values {{name}} {{name}};{{/isValueLablled}} {{/variables}} {{/valueLabelled}} save \`dta_name', replace; `; var spssSyntaxTemplate = `FILE HANDLE fwffile / NAME='{{filePath}}'. DATA LIST file = fwffile/ {{#variables}} {{name}} {{startColumn}}{{#multiChar}}-{{endColumn}}{{/multiChar}}{{#isString}} (A){{/isString}}{{#isDecimal}} ({{dcml}}){{/isDecimal}}{{/variables}} . VARIABLE LABELS{{#variables}} {{name}} "{{{labl}}}"{{/variables}} .{{#valueLabelled}} VALUE LABELS{{#variables}}{{#isValueLablled}} {{name}} {{#labelledValues}} {{catValu}} "{{{labl}}}"{{/labelledValues}}/{{/isValueLablled}}{{/variables}}.{{/valueLabelled}} EXECUTE.`;