Data & analysis

statdata-transfer

Try it

读入/转存 50+ 统计软件格式,对统计二进制格式完整保留变量标签/值标签/特殊缺失值等元数据。副作用声明(完整):运行环境检查(scripts/check_env.py);可应要求 pip 安装缺失包;写入主输出文件的同时可能生成 sidecar 元数据(CSV/TSV 旁 <名>_metadata.json、Parquet/Arrow 内嵌)及覆盖 .hyper 时的 .bak/.bak.1 备份;处理 .rda/.rds/.RData/.mtw/.mpj/.rec 时可调用本地 R 解释器,但该回退默认禁用,需 allow_r_exec=True 显式开启。 / Read/convert 50+ statistical software formats, preserving variable/value labels and missing-value metadata for binary stats formats. FULL side effects: runs environment checks (scripts/check_env.py); may optionally pip-install missing packages on request; writes the main output file AND may emit sidecar metadata (e.g. <name>_metadata.json beside CSV/TSV, embedded in Parquet/Arrow schema) and .bak/.bak.1 backups when overwriting .hyper; can invoke the local R interpreter for .rda/.rds/.RData/.mtw/.mpj/.rec files via a fallback DISABLED by default and opted in only with allow_r_exec=True.

What it does

读入/转存 50+ 统计软件格式,对统计二进制格式完整保留变量标签/值标签/特殊缺失值等元数据。副作用声明(完整):运行环境检查(scripts/check_env.py);可应要求 pip 安装缺失包;写入主输出文件的同时可能生成 sidecar 元数据(CSV/TSV 旁 <名>_metadata.json、Parquet/Arrow 内嵌)及覆盖 .hyper 时的 .bak/.bak.1 备份;处理 .rda/.rds/.RData/.mtw/.mpj/.rec 时可调用本地 R 解释器,但该回退默认禁用,需 allow_r_exec=True 显式开启。 / Read/convert 50+ statistical software formats, preserving variable/value labels and missing-value metadata for binary stats formats. FULL side effects: runs environment checks (scripts/check_env.py); may optionally pip-install missing packages on request; writes the main output file AND may emit sidecar metadata (e.g. <name>_metadata.json beside CSV/TSV, embedded in Parquet/Arrow schema) and .bak/.bak.1 backups when overwriting .hyper; can invoke the local R interpreter for .rda/.rds/.RData/.mtw/.mpj/.rec files via a fallback DISABLED by default and opted in only with allow_r_exec=True.

The skill document

Statistical Data Format Converter

Safe by default — preview, not execute: the skill shows what it will read/convert and only writes a file when you explicitly ask. Every R-invoking path is opt-in and disabled by default.

Language

This skill responds in the user's input language and auto-switches; runtime prompts switch by locale. SKILL.md body is English-only (agent-facing); bilingual walkthroughs live in the two READMEs.

Purpose

Read 50+ statistical-software and clinical-trial data formats into a pandas DataFrame, and inter-convert between most formats (SPSS ↔ Stata ↔ R ↔ SAS XPT ↔ Excel ↔ Parquet ↔ HDF5 ↔ JSON …). For statistical binary formats it preserves full variable/value labels and special-missing-value metadata; text/JSON formats preserve only a retainable subset.

Features

CapabilityDescriptionTypical Scenario
ReadExtract data + all metadata from 50+ formats into a pandas DataFrame; clearly report what is preserved vs lostread data.sav and show metadata
ConvertInter-convert most stats formats; export to universal formats (Parquet/Feather/HDF5/JSON/CSV/Excel) with labels embeddedconvert data.sav to .dta keeping variable labels
Embed metadataLabels embedded in Arrow schema.metadata / sidecar JSON for lossless round-tripssave to parquet but keep value labels
WarnAuto-detect and report metadata loss per conversion pathaudit before exporting to CSV

Supported Formats

50+ formats, sorted alphabetically.

FormatExtensionMeta Preserve
CDISC ODM.odm⚠️ Clinical data only
dBASE / FoxPro.dbf⚠️ Read+Write, uppercase names
EpiData.rec⚠️ Via R (opt-in)
EpiInfo.prj .xml✅ XML structure
Excel.xlsx .xls .xlsm⚠️ Extra sheet for labels; merged-cell fill
EViews.wf1 .wf2⚠️ JSON structure
Feather.feather .arrow✅ Via schema
FST.fst✗ Detect-only (proprietary)
GraphPad Prism.pzfx .pz⚠️ Multi-table
Gretl.gdt .gdtb✅ String-tables
HDF5.h5 .hdf5⚠️ Hierarchy + attribute labels
HTML.html⚠️ Tables only
jamovi.omv✅ JSON analysis
JMP.jmp⚠️ Multi-table
JSON.json✅ stat-full-meta
MATLAB.mat⚠️ v7.3+ via h5py fallback
Mathematica.wdx⚠️ Best-effort XML
Minitab.mtw .mpj⚠️ Via R (opt-in)
MS Access.mdb .accdb⚠️ Multi-table; needs system driver
ODS.ods⚠️ Data only
ORC.orc✅ Via schema
Origin.opju .oggu⚠️ Best-effort
Parquet.parquet✅ Via schema; partitioned datasets
R.rda .rds .rdata✅ pyreadr; R fallback opt-in (allow_r_exec)
SAS.sas7bdat .xpt .sas7bcat
SPSS.sav .zsav .por
Stata.dta
Weka ARFF.arff✅ Nominal mapping
XML.xml⚠️ Structure preserved

✅=Full · ⚠️=Partial/conditional · ✗=Not preserved

12 detect-only formats (SAS CPORT .cpt, Statistica .sta, OxMetrics .in7, SYSTAT .sys/.syd, Paradox .db/.px, LIMDEP .lpw, NCSS .ncss, FST) give clear export guidance — see README.

Return Structure

{
    "dataframe": pd.DataFrame,
    "metadata": {
        "file_format": "spss_sav",
        "row_count": 100, "column_count": 10,
        "variable_labels": {"q1": "Question 1"},
        "value_labels": {"q1": {1: "Yes", 2: "No"}},
        "special_missing": {...},
    },
    "warnings": [],
    "column_report": {"q1": {"source_type": "int", "pandas_dtype": "int64"}},
}

Quick Start

# Check environment (optional install on request)
python scripts/check_env.py --install

In WorkBuddy (bilingual, auto-detects your language):

> convert data.sav to .dta
> read data.sav and show metadata
> 把 data.sav 转成 .dta 并保留变量标签

For complete code examples, see references/usage_examples.py.

Dependencies

requires:
  bins: [python3]
  packages:
    core: [pyreadstat>=1.3.5,<2, pyreadr>=0.4,<0.5, pandas>=2.0,<3]
    extended: [openpyxl, xlrd, scipy, h5py, pyarrow, lxml, odfpy, tableauhyperapi, dbfread, dbf, pyodbc]

Full list: requirements.txt

⚠️ Safety

  • All R-invoking paths are opt-in and disabled by default; they only run when you pass allow_r_exec=True on a trusted file.
  • Pure-Python parsers (pyreadr, mtbpy) are tried first and never execute code.
  • No silent R fallback — if the pure-Python parser fails and allow_r_exec is not set, the skill raises a clear error.
  • Writing an existing .hyper backs up to .bak before overwrite; on failure the original is untouched.
  • Output for reference only; validate before regulatory submissions.

Security model (transparent disclosure)

BehaviorDescription
R invocation (opt-in)Reading .rda/.rds/.RData (readRDS()/load()), Minitab .mtw/.mpj, EpiData .rec, and writing R formats run only with allow_r_exec=True on a trusted file. Pure-Python parsers tried first.
No silent fallbackOn pure-Python parser failure without allow_r_exec, raises a clear error instead of launching R — avoids executing embedded code from untrusted files.
Static R templatesWhen the opt-in R path runs, all R scripts are static templates; user input passes only as CLI args (commandArgs(trailingOnly=TRUE) via jsonlite) — never concatenated into executable R code.
Temp CSV bridgeOpt-in R writes data to a temp CSV then reads back; deleted after use, but on crash could briefly persist — avoid highly sensitive data through R-backed formats.
No destructive writes.hyper write → temp file → rotate existing to .bak (prior .bak.bak.1, never silently deleted) → atomic swap. Original untouched on failure.
Sidecar metadata filesWriting CSV/TSV also emits _metadata.json (full 17-field metadata) next to the data file; Parquet/Arrow embed metadata inside the file schema. No writes occur outside the output path you specify.
Pinned dependenciesCore deps carry upper-bound pins (pandas, pyreadstat, pyreadr) — see requirements.txt.
Optional installpython scripts/check_env.py --install only on explicit request.
PermissionsRead the input file; write the output file to a path you specify. No network unless you explicitly request package install.

License

MIT. See LICENSE.

Related skills

跨平台统计软件 CLI 集成,面向 AI Agent;覆盖 34+ 款软件(R/Stata/SAS/SPSS/Python/贝叶斯/ML等),双语。核心价值:激活历史代码资产,用于 AI 工作流自动化。 / Cross-platform statistical software CLI integration for AI Agent; 34+ packages (R/Stata/SAS/SPSS/Python/Bayesian/ML, etc.), bilingual. Core value: activating historical code assets for AI workflow automation.

1 installs

Comprehensive R-based meta-analysis skill covering RevMan 5.x + Stata equivalents (metareg/mvmeta) + esc + RVE + Bayesian NMA (Stan/JAGS) + survival meta + TSA + single-group meta + diagnostic meta + systematic review workflow; produces forest plots, funnel plots, heterogeneity (I²), publication bias, subgroup analysis, meta-regression, network meta, for a total of 23 analysis figures. Auto-switches language (defaults to English, switches to Chinese in zh-* environments). All analyses ship reproducible R code. / 基于 R 的全方位 Meta 分析技能,覆盖 RevMan 全部功能 + Stata 等价(metareg/mvmeta)+ esc + RVE + 贝叶斯 NMA(Stan/JAGS)+ 生存 Meta + TSA + 单组率 Meta + 诊断 Meta + 系统评价流程;输出森林图、漏斗图、异质性(I²)、发表偏倚、亚组分析、元回归、网络 Meta等共 23 种分析图形。中英双语自动切换(默认英文/中文环境切中文),所有分析提供可复现 R 代码。

将不同银行导出的流水 Excel / CSV 批量转换为监管报送标准格式(9 列)。Use when: 用户需要转换银行流水格式、汇总多银行多账户流水、整理监管报送数据。NOT for: 非银行流水文件处理、加密/损坏文件修复。需要 Python3 + openpyxl + xlrd。

29 installs1 stars

用于诊断英文心理学论文 Results(结果)部分的统计报告规范,检查 M、SD、t(df)、F(df1, df2)、p 值、效应量(Cohen's d、partial η²、r 等)、置信区间的报告格式与完整性,以及统计结果与文字描述的一致性,判断是否符合 APA 风格统计报告习惯。当用户提供 Results 草稿并希望检查统计报告格式、补充效应量或置信区间、核对统计量与文字描述是否一致、或需要按 APA 格式改写统计结果陈述时触发本 Skill。仅针对 Results 部分的统计报告写作规范,不替代统计计算本身。

完整实证研究工作流管理技能。整合 codex-stata-for-economists 的工程化方法论与 Stata-MCP 执行工具。 使用场景:(1) Stata do-file 编写、调试、执行与优化 (2) 实证研究流水线搭建与项目管理 (3) 论文结果复现与审查(replication/robustness)(4) 计量经济学方法选择与实现 (5) 研究日志溯源校验(log verification)(6) 提交前质量审核与评分 当用户提到以下关键词时触发:stata, do文件, do-file, dofile, dta, 面板数据, panel, did, 双重差分, 倍分法,

药企药物研发辅助临床试验数据统计。参考 Statistical Analysis skill 的 descriptive statistics 与 group comparison 部分,构建试验分析支持能力。

13 installs