为了账号安全,请及时绑定邮箱和手机立即绑定

以下内容是关于一个stata的题目,请问该怎么做呀?

以下内容是关于一个stata的题目,请问该怎么做呀?

题目是英语的,教育和婚姻变量没labels,请根据下边副本里的价值标签给教育和婚姻贴上标签The variables –education– and –married– are numeric but do not have valuelabels, yet. Label the values of the two variables according to those given belowin the Appendix.Value labels–married–:1 - married2 - not married–education–: 1 - tertiary2 - unfinished tertiary3 - special secondary4 - secondary5 - 7 years of schooling 6 - primary7 - can read and write 8 - can read9 - illiterate10 - child aged 0-8 99 - missing value
查看完整描述

2 回答

?
慕尼黑8549860

TA贡献1818条经验 获得超11个赞

cd /Victor/stata

//二

//1.a

sysuse "auto.dta",clear

foreach num of numlist 1/74{

export excel using "auto`num'.xlsx" in `num'

}

//1.b

foreach num of numlist 1/74{

import excel "auto`num'", clear

save "auto`num'.dta", replace

}

//将excel转换成dta格式

use "auto1.dta",clear

foreach num of numlist 2/70{

append using "auto`num'.dta"

}

save "auto_new.dta", replace

//1.c

foreach num of numlist 1/74{

erase "auto`num'.xlsx"

}

//2(因为我的stata软件无法识别跨行命令,只能一长串写在一行)

use "auto_new.dta",clear

twoway(scatter weight mpg if foreign == 0, mcolor(navy blue) msymbol(x)) (scatter weight mpg if foreign == 1, mcolor(red))  , legend(on order(1 "foreign" 2 "domestic")  ring(0)) title("The Relatonship between Car Weight and MPG") ylabel(1000 2000 3000(2000)5000) xlabel(10(5)35)

//3

sysuse "nlsw88.dta",clear

tabstat wage hours ttl_exp tenure ,by(union) stat(n mean sd min median) c(s)

//4

sysuse "nlsw88.dta",clear

order wage hours ttl_exp tenure collgrad

foreach v of varlist wage-collgrad{

ttest `v',by(union)

}

//5

sysuse "nlsw88.dta",clear

reg wage age race industry occupation ttl_exp hours

ssc install logout

logout, save(result_2017302330037.xlsx) excel dec(3) replace:reg wage age race industry occupation ttl_exp hours

//三

sysuse "firm.dta",clear

sort ID date ipc patent_ID

//2

replace firm_name = subinstr(firm_name, "有限责任公司"," ",.)   

replace firm_name = subinstr(firm_name, "集团股份有限公司"," ",.)

replace firm_name = subinstr(firm_name, "股份有限公司"," ",.)

//3

//计算每个企业每年专利数量总和

use "firm.dta",clear

encode patent_ID ,gen(patent_ID1) 

bys ID date : egen num_patent=count(patent_ID1)

//计算不重复的领域数

duplicates drop ID date ipc,force

bys ID date: egen ipc_sum=count(ipc)



查看完整回答
反对 回复 2022-01-09
?
天涯尽头无女友

TA贡献1831条经验 获得超9个赞

label命令比较简单的

查看完整回答
反对 回复 2022-01-09
  • 2 回答
  • 0 关注
  • 344 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号