reshape wide pcgdp,i(city) j(year)
i(varlist) 只是充当在wide形式下唯一的识别变量(组)而已,并不要求必须是序号(数字型)。
Basic syntax
Convert data from wide form to long form
reshape long stubnames, i(varlist) [options]
Convert data from long form to wide form
reshape wide stubnames, i(varlist) [options]
options Description
----------------------------------------------------------------------------------------------------------------------------------------
* i(varlist) use varlist as the ID variables
j(varname [values]) long->wide: varname, existing variable
wide->long: varname, new variable
optionally specify values to subset varname
string varname is a string variable (default is numeric)
----------------------------------------------------------------------------------------------------------------------------------------
* i(varlist) is required.
Advanced syntax:
reshape i varlist
reshape j varname [values] [, string]
reshape xij fvarnames [, atwl(chars)]
reshape xi [varlist]
reshape [query]
reshape clear
Options
specifies that j() may contain string values.
, available only with the advanced syntax and not shown in the dialog box, specifies that plain ASCII chars be substituted for the @ character when converting the data from wide to long form.