Title

supershape -- Enhanced reshape allows you to retain
variable labels and fill in zeros after wide reshape.

Syntax

supershape long|wide stub[s],
i(varlist)
[j(varlist)
keeplabels
labels(varname)
fill string]

See reshape for information on how to reshape.

Description

supershape provides a few enhancements to Stata's built-in
reshape command. Most importantly, it adds options to retain labels when
going from wide to long and to assign labels going from long to wide.

The basic syntax works almost exactly as does the syntax for reshape.
You can include multiple stubs; you can use the @ symbol when necessary;
i() is required.

Two other enhancements: the ability to fill in zeros when reshaping
from long to wide and the ability to omit the string option when j()
contains a string variable.

Options

j(varname) works much the same way as in reshape.
However, j() has no effect when reshaping long.

keeplabels specifies that the labels for variables that are
being reshaped should be retained. They will be stored in a new variable
named stub_label. Should only be used with reshape long.

labels(varname) specifies the variable containing
the labels for the stub. There must be a 1:1 match between values and labels.
If there is not a 1:1 match, the command will not show an error, but the
labels may not be correct. If you're using this option, you can only be
reshaping a single variable. Should only be used with reshape wide.

fill fills in zeros for missing variables after reshape wide.
Used when you have a comprehensive list of observations. For example, if you
inpatient visits by year and county, and reshape them wide, the observations
that are missing, are actually zero-visit observations.

string tells reshape that the variable in j() is a string.
This is required in Stata's reshape command. supershape does not require
it, as the program determines for itself whether j() is a string.

Examples

. supershape long inc, i(state)

. supershape wide inc, i(state) j(yr) fill

. supershape wide inc, i(state) j(yr) labels(yr_descript)

. supershape long inc, i(state) keep

Authors

Jeremy Nighohossian

FTI Consulting

Washington, DC

Also see

Help: reshape