
Security News
CISA’s 2025 SBOM Guidance Adds Hashes, Licenses, Tool Metadata, and Context
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
stats_package_syntax_file_generator
Advanced tools
This gem produces statistical package syntax files for fixed-column data files.
SAS
SPSS
Stata
Stat/Transfer STS metadata files
R (via the ipumsr package which depends on IPUMS DDIs)
Metadata can be supplied to the Controller in two general ways:
- Programmatically, using the API provided by the Controller class.
- Via one or more YAML files -- typically just one YAML file, but the
Controller will accept multiple files and merge their content.
Basic usage:
require 'stats_package_syntax_file_generator'
# Supply metadata via one YAML file.
sfc = SyntaxFile::Controller.new(:yaml_files => 'metadata.yaml')
# Or via multiple YAML files.
sfc = SyntaxFile::Controller.new(:yaml_files => ['md1.yaml', 'md2.yaml'])
# Or programmatically.
# For a working example, see devel/api_example.rb.
# Generate all syntax files.
sfc.generate_syntax_files
# Generate a syntax file of a specific TYPE (spss, sas, stata).
sfc.generate_syntax_file('TYPE')
# Ditto, but get the syntax as a list of strings rather than writing a file.
syntax_lines = sfc.syntax('TYPE')
Running tests:
devel/run_all_checks.sh
Project structure:
devel/
# Developer area.
# Various scripts, plus the following:
input/
# YAML metadata used during development
# and in end-to-end acceptance testing.
output_expected/
# Acceptance testing: expected output.
output_result/
# Acceptance testing: directory where new output
# is written. This output is not included in Git.
lib/ # The syntax file utility itself.
tests/ # Unit test scripts and their YAML metadata.
Class overview:
Controller
- The API for the gem. Users of the gem should not need to interact with
other classes.
- Serves as a container for the metadata needed to generate syntax files.
- Holds various attributes specifying the type of syntax files to
generate, the structure of the data files, and so forth.
Variable
Value
- Metadata classes holding information about variables in the data file.
- A Controller contains 1+ Variable objects.
- A Variable contains 0+ Value objects.
Maker
Maker_SAS
Maker_SPSS
Maker_STATA
Maker_STS
Maker_RDDI
- Classes responsible for creating syntax.
- Maker provides methods that all classes have in common.
- The other classes inherit from Maker, overriding behavior as needed.
General behavior of the specific Maker classes:
- The classes all define a primary method: syntax().
- The syntax() method consists of calls to various other methods responsible
for generating sections of the syntax.
- Methods that generate sub-sections of syntax have names beginning with 'syn_'.
- All of the syntax-generating methods return a list of strings.
Notes on STS files:
1. Hierchical data.
Stat/Transfer does not directly support hierarchical data structures. The
workaround is to perform multiple invocations of Stat/Transfer, once per record
type. Each invocation must instruct Stat/Transfer to perform case selection to
filter the records such that a single record type is in scope, and must request
the variables appropriate for that record type.
2. Variable and value labels with quotes.
Stat/Transfer does not support escaping quotes within value labels. Therefore,
double quotes are represented by a pair of single quotes.
3. Only alphanumeric values are permitted for value labels.
Nonconforming values are skipped, with a comment added to the STS file that
documents this action.
FAQs
Unknown package
We found that stats_package_syntax_file_generator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.