Syntax - Stata
Convert data from wide to long form and vice versaSyntaxMenuDescriptionOptionsRemarks and examplesStored resultsAcknowledgmentReferencesAlso seeSyntaxOverviewlongwidei j stubi go from long to wide:jexisting variable/reshape widestub, i(i) j(j)To go from wide to long:reshape longstub, i(i) j(j)\jnew variableTo go back to long after usingreshape wide:reshape longTo go back to wide after usingreshape long:reshape wideBasic syntaxConvert data from wide form to long formreshape longstubnames, i(varlist)[options]Convert data from long form to wide formreshape widestubnames, i(varlist)[options]Convert data back to long form after using reshape widereshape long12 reshape Convert data from wide to long form and vice versaConvert data back to wide form after using reshape longreshape wideList problem observations when reshape failsreshape erroroptionsDescription i(varlist)usevarlistas theIDvariablesj(varname[values])long wide:varname, existing variablewide long:varname, new variableoptionally specify values to subsetvarnamestringvarnameis a string variable (default is numeric) i(varlist)is #[-#][#.]
Think of the data as a collection of observations X ij, where i is the logical observation, or group identifier, and j is the subobservation, or within-group identifier. ... In summary, there are three cases in which reshape will refuse to convert the data: 1. The data are in wide form and i is not unique. Advanced issues with basic syntax: i ...
Download Syntax - Stata
Information
Domain:
Source:
Link to this page:
Please notify us if you found a problem with this document: