全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 Stata专版
2318 1
2008-08-09
<p>希望打下帮我编个小程序,现在有HS-6位码的各种商品各个国家的单位出口价格(p)和出口量(q),在求出各种商品的世界平均价格(uv)后,把商品分成低、中、高三类,划分原则如下:</p><p>For each HS-6 product, we compute the world unit value average (noted UV). We then classify each flow:</p><p>– Flows with unit values verifying UV−25%, UV+25% belong to the medium range, along</p><p>with the last decile of [min,  UV−25%] and the first decile of [  UV + 25%, max].</p><p>– The first nine deciles of [min, UV−25%] are considered low range.</p><p>– The last nine deciles of [UV +25%, max] are considered high range.</p><p>谢谢大家的帮助。</p>
二维码

扫码加我 拉你入群

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

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

全部回复
2008-8-12 16:45:00

Supposing your dataset is as follows:

name  price

A     10

A     15

   

B     20

B     30

   

 

Hope the Stata codes below will help you to solve your problem.

 

 

sort name

egen int gname = group(name)

qui tabu gname

local ngname = `r(r)'

forvalue i = 1(1)`ngname' {

  qui sum price if gname == `i', d

  gen int group`i' = irecode(price,`r(p25)',`r(p75)') if gname == `i'

}

sort name price group1-group`ngname'

 

二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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