RESHAPEHELPER: Stata module to diagnose the dataset and suggest (never run) the likely reshape command
Eric Booth
Statistical Software Components from Boston College Department of Economics
Abstract:
A dry-run advisor for Stata's hardest data-management command. reshapehelper never reshapes your data. It scans variable names for wide patterns (numeric suffixes, string suffixes, @ mid-name stubs, doubly-wide double indices), finds candidate i and j variables (honoring xtset/tsset and svyset declarations), decides the likely direction, composes the reshape command, and TESTS it on a small sample inside preserve/restore, iterating on reshape's own errors (string j, spaces in j, duplicates within i-j, non-constant variables) until the suggestion runs or the blocker is diagnosed. Output: an ASCII before/after diagram of what the suggestion would do, the suggested syntax with its dry-run verdict (also stored in r(cmd) and $reshapehelper_cmd, written unwrapped to a viewable SMCL file, and offered as a click-to-run link), or - when it cannot discern the design - a numbered checklist of what to fix or specify before running reshapehelper again. Flags transpose jobs that are really xpose/sxpose problems.
Language: Stata
Requires: Stata version 16.0
Keywords: reshape; data management; long; wide (search for similar items in EconPapers)
Date: 2026-07-30
Note: This module should be installed from within Stata by typing "ssc install reshapehelper". The module is made available under terms of the MIT license (https://opensource.org/licenses/MIT).
References: Add references at CitEc
Citations:
Downloads: (external link)
http://fmwww.bc.edu/repec/bocode/e/example_reshapehelper.do example do-file (text/plain)
http://fmwww.bc.edu/repec/bocode/r/reshapehelper.ado program code (text/plain)
http://fmwww.bc.edu/repec/bocode/r/reshapehelper.sthlp help file (text/plain)
Related works:
This item may be available elsewhere in EconPapers: Search for items with the same title.
Export reference: BibTeX
RIS (EndNote, ProCite, RefMan)
HTML/Text
Persistent link: https://EconPapers.repec.org/RePEc:boc:bocode:s459831
Ordering information: This software item can be ordered from
http://repec.org/docs/ssc.php
Access Statistics for this software item
More software in Statistical Software Components from Boston College Department of Economics Boston College, 140 Commonwealth Avenue, Chestnut Hill MA 02467 USA. Contact information at EDIRC.
Bibliographic data for series maintained by Christopher F Baum ().