楼主: ddecheng
1179 2

[数据管理求助] 请教reshape的高级句法 [推广有奖]

  • 0关注
  • 0粉丝

初中生

61%

还不是VIP/贵宾

-

威望
0
论坛币
64 个
通用积分
29.0548
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
2705 点
帖子
10
精华
0
在线时间
12 小时
注册时间
2014-9-9
最后登录
2022-4-8

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
请教大神,reshape的高级句法与普通句法相差很大,下面的高级句法是什么意思呀? Advanced syntax

        reshape i varlist


        reshape j varname [values] [, string]


        reshape xij fvarnames [, atwl(chars)]


        reshape xi [varlist]



二维码

扫码加我 拉你入群

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

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

关键词:reshape Shape APE RES Advanced

沙发
ddecheng 发表于 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里面是详细的介绍

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-5-5 09:02