楼主: lvchan521
33417 18

[数据管理求助] 关于pctile 和xtile,求教,感谢! [推广有奖]

  • 2关注
  • 0粉丝

已卖:41份资源

本科生

33%

还不是VIP/贵宾

-

威望
0
论坛币
276 个
通用积分
0.0016
学术水平
0 点
热心指数
1 点
信用等级
0 点
经验
1778 点
帖子
66
精华
0
在线时间
58 小时
注册时间
2012-2-9
最后登录
2023-11-7

楼主
lvchan521 发表于 2012-3-29 23:22:30 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
本人需要用讲所有的观测数据划分为5组,每一组需要是从同一个 行业 and 年份 中具有相同ROA的公司,请问是否应该用pctile 或者xtile ?具体要怎样操作,感谢!
二维码

扫码加我 拉你入群

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

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

关键词:xtile Tile PCT CTI 是否应该 行业

回帖推荐

sungmoo 发表于12楼  查看完整内容

*根据你前面写的,似乎可以用: bys industry year (roa): cumul roa,g(p) eq recode p (0/.2=1)(.2/.4=2)(.4/.6=3)(.6/.8=4)(.8/1=5)

沙发
lvchan521 发表于 2012-3-30 14:00:49
无人回应,自己给自己顶一下~

藤椅
dxystata 发表于 2012-3-30 17:17:28
pctile creates a new variable containing the percentiles of exp, where the expression exp is typically just another variable.

xtile creates a new variable that categorizes exp by its quantiles.  If the cutpoints(varname) option is
specified, it categorizes exp using the values of varname as category cutpoints.  For example, varname might contain percentiles of another variable, generated by pctile.

板凳
lvchan521 发表于 2012-3-30 21:35:25
dxystata 发表于 2012-3-30 17:17
pctile creates a new variable containing the percentiles of exp, where the expression exp is typical ...
Thanks for your sharing~
请问版主,关于我的问题,要执行怎样的stata命令呢?谢谢啦~

报纸
tianye 在职认证  发表于 2012-3-30 23:22:56
lvchan521 发表于 2012-3-30 21:35
Thanks for your sharing~
请问版主,关于我的问题,要执行怎样的stata命令呢?谢谢啦~
直接用cond的命令就可以实现分组吧
例如,我想把相同性别和教育程度分出来一组,则用
gen x=cond(sex==1&edu==1, 1, 0)
replace x=2 if (sex==2)& (edu==2)
replace ........直到替换完为止吧。
或者麻烦点就用gen的命令应该也可以吧。

地板
aolei 发表于 2012-3-30 23:28:02
把数据贴出来,说明一下

7
lvchan521 发表于 2012-4-1 21:40:25
tianye 发表于 2012-3-30 23:22
直接用cond的命令就可以实现分组吧
例如,我想把相同性别和教育程度分出来一组,则用
gen x=cond(sex== ...
谢谢你哦^@^不过这应该不是我想要的

8
lvchan521 发表于 2012-4-2 16:29:25
aolei 发表于 2012-3-30 23:28
把数据贴出来,说明一下
我要在同一个industry-year里将我的obs.按照ROA分成5组,换句话说每一个industry-year里会有5个categories,然后在每一组里取一个industry median,这个code要怎么写呢?
详细点说就是:
首先,我需要讲我的观测值按照industry, year 分组;
然后,再在每一组里按照ROA再分5类, (这时候可能需要用到 xtile);
然后,我需要在每一类里取一个industry median.

谢谢

9
lvchan521 发表于 2012-4-2 16:31:53
是不是首先应该egen group=group (industry year)
然后 xtile (这个不知道要怎么用............)

10
lvchan521 发表于 2012-4-2 16:44:33
我先egen group=group (industry year)
然后, sum group
forval i=1/`r(max)'{
xtile temp = ROA, nq(5), [if group==`i']
}
我就是想加个if语句,但是不知道怎么写............
跑出来的结果显示“weights not allowed”

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

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2026-1-21 09:21