{smcl} {* 20jun2014}{...} {vieweralsosee "[D] reshape" "help reshape"}{...} {vieweralsosee "" "--"}{...} {vieweralsosee "[D] reshape" "mansection D reshape"}{...} {viewerjumpto "Options" "supershape##Options"}{...} {viewerjumpto "Examples" "supershape##Examples"}{...} {title:Title} {p 4 18 2}{cmd:supershape} {hline 2} Enhanced reshape allows you to retain variable labels and fill in zeros after wide reshape.{p_end} {title:Syntax} {p 8 19 2} {cmd:supershape} long|wide {it:stub[s]}{cmd:,} {cmd:i(}{it:varlist}{cmd:)} [{cmd:j(}{it:varlist}{cmd:)} {cmdab:keep:labels} {cmd:labels(}{it:varname}{cmd:)} {cmdab:f:ill} {cmdab:s:tring}] {pstd}See {help reshape} for information on how to reshape. {title:Description} {pstd} {cmd: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. {pstd} The basic syntax works almost exactly as does the syntax for reshape. You can include multiple stubs; you can use the @ symbol when necessary; {cmd:i()} is required. {pstd} Two other enhancements: the ability to fill in zeros when reshaping from long to wide and the ability to omit the string option when {cmd:j()} contains a string variable. {marker Options}{...} {title:Options} {phang} {cmd:j(}{it:varname}{cmd:)} works much the same way as in reshape. However, {cmd:j()} has no effect when reshaping long. {phang} {cmd:keeplabels} specifies that the labels for variables that are being reshaped should be retained. They will be stored in a new variable named {it:stub}_label. Should only be used with reshape long. {phang} {cmd:labels(}{it:varname}{cmd:)} 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. {phang} {cmd: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. {phang} {cmd:string} tells reshape that the variable in {cmd:j()} is a string. This is required in Stata's reshape command. {cmd:supershape} does not require it, as the program determines for itself whether {cmd:j()} is a string. {marker Examples}{...} {title:Examples} {p 4 6 2}{cmd:. supershape long inc, i(state)}{p_end} {p 4 6 2}{cmd:. supershape wide inc, i(state) j(yr) fill}{p_end} {p 4 6 2}{cmd:. supershape wide inc, i(state) j(yr) labels(yr_descript)}{p_end} {p 4 6 2}{cmd:. supershape long inc, i(state) keep}{p_end} {title:Authors} {pstd}Jeremy Nighohossian{break} FTI Consulting{break} Washington, DC{break} {title:Also see} {p 4 14 2} {space 3}Help: {helpb reshape} {p_end}