全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 Stata专版
1526 2
2017-05-16
请教大神,reshape的高级句法与普通句法相差很大,下面的高级句法是什么意思呀? Advanced syntax

        reshape i varlist


        reshape j varname [values] [, string]


        reshape xij fvarnames [, atwl(chars)]


        reshape xi [varlist]



二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2017-6-5 13:00:49
[b]我在stata中的help找到了。
附给大家。
Reshape高级句法
Description of advanced syntax
The advanced syntax is simply a different way of specifying the reshape command, and it has one seldom-used feature that provides extra control. Rather than typing one reshape command to describe the data and perform the conversion, such as
. reshape long inc, i(id) j(year)
you type a sequence of reshape commands. The initial commands describe the data, and the last command performs the conversion:
. reshape i id
. reshape j year
. reshape xij inc
. reshape long

reshape i corresponds to i() in the basic syntax.
reshape j corresponds to j() in the basic syntax.
reshape xij corresponds to the variables specified in the basic syntax. reshape xij also accepts the atwl() option for use when @ characters are specified in the fvarnames. atwl stands for at-when-long. When you specify names such as inc@r or ue@, in the long form the names become incr and ue, and the @ character is ignored. atwl() allows you to change @ into whatever you specify. For example, if you specify atwl(X), the long-form names become incXr and ueX.
There is also one more specification, which has no counterpart in the basic syntax:
. reshape xi varlist
In the basic syntax, Stata assumes that all unspecified variables are constant within i. The advanced
syntax works the same way, unless you specify the reshape xi command, which names the constant-
within-i variables. If you specify reshape xi, any variables that you do not explicitly specify are
dropped from the data during the conversion.
As a practical matter, you should explicitly drop the unwanted variables before conversion. For
instance, suppose that the data have variables inc80, inc81, inc82, sex, age, and age2 and that
you no longer want the age2 variable. You could specify
. reshape xi sex age
or
. drop age2
and leave reshape xi unspecified.
reshape xi does have one minor advantage. It saves reshape the work of determining which variables are unspecified. This saves a relatively small amount of computer time.
Another advanced-syntax feature is reshape query, which is equivalent to typing reshape byitself. reshape query reports which reshape parameters have been defined. reshape i, reshape j, reshape xij, and reshape xi specifications may be given in any order and may be repeated to change or correct what has been specified.
Finally, reshape clear clears the definitions. reshape definitions are stored with the dataset when you save it. reshape clear allows you to erase these definitions.
The basic syntax of reshape is implemented in terms of the advanced syntax, so you can mix basic and advanced syntaxes.
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2017-6-5 13:29:23
看stata的manual里面是详细的介绍
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群