楼主: Hdaob
1344 1

[编程问题求助] stata 变量备份与恢复 [推广有奖]

  • 0关注
  • 0粉丝

大专生

78%

还不是VIP/贵宾

-

威望
0
论坛币
983 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
232 点
帖子
6
精华
0
在线时间
120 小时
注册时间
2020-3-20
最后登录
2022-9-13

楼主
Hdaob 发表于 2020-5-30 12:05:54 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
replication data里文件里要求装backup和backto的包来备份变量的不同版本,但是网站打不开装不上,请问有替代方法吗?
*Install "backup" and "backto" ado files, which create backed up versions of variables
net from http://home.gwu.edu/~bartels/stata
*install 'backto' and 'backup' by clicking on them


二维码

扫码加我 拉你入群

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

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

关键词:Stata tata Replication Variables do files Stata stata数据处理 stata学习

沙发
Hdaob 发表于 2020-5-30 12:33:04
*Install "backup" and "backto" ado files, which create backed up versions of variables
net from http://home.gwu.edu/~bartels/stata
*install 'backto' and 'backup' by clicking on them
logit meritocracy grind812cnty grind812_2 medearn812cnty_01 medearn812cnty01_2 gini0812cnty_01 pctfembus07cnty_01 bsf812cnty_01 punemp812cnty_01 pubsector0812cnty_01 pmccain_01 popden0812cnty_01 totpop812cnty_01 womgov08 pwomstleg08_01 education_01 income_i_01 Age black hispanic asian married unemployed partyid_01 ideology_01 religattend_01 sid20094 s2011 s2012 if male==0
gen obs=1 if e(sample)
sort obs
backup grind812cnty grind812_2
qui gen prob_grind=.

set more off

forvalues i=1(1)6183 {
        qui replace grind812cnty=grind812cnty[`i']
        qui replace grind812_2=grind812_2[`i']
        qui predict prob if obs==1
        qui su prob
        qui replace prob_grind=r(mean) in `i'
        qui drop prob
        qui backto grind812cnty grind812_2
        di `i'
}

backto grind812cnty grind812_2

label var prob_grind "Predicted Probability"
line prob_grind grind812cnty, sort
sort prob_grind
list  prob_grind grind812cnty if _n==6183
line prob_grind grind812cnty if obs==1, sort

完整的代码是这样的

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

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2025-12-29 05:13