全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 Stata专版
16747 3
2010-03-14
STATA为什么会提示以下错误?
. drop _all
.
. set more 1
.
. macro drop _all
.
. #delimit ;
Unknown #command
.
.
.
.
.
. *THIS FILE SHOWS SUMMARY STATS ON PRODUCTION WORKER EARNINGS AND EMPLOYMENT FOR ALL M
> ANUFACTUING AND OUTSOURCING INDUSTRIES IN US AND MEXICO TO BE
.
. USED FOR FIGURE 1 IN BFH PAPER. THE DATA USED FROM THE EXERCISE ARE SEASONALLY ADJUST
> ED, LOGGED, HP FILTERED DATA ON MEXICAN AND US INDUSTRIES.  
unrecognized command:  USED
r(199);
.
. THE RESULTS ARE FOR THE BERGIN, FEENSTRA, HANSON AER PAPER;
unrecognized command:  THE
r(199);
.
.
.
. use us-filtered.dta;
invalid ';'
r(198);
.
. label list indlbl;
value label indlbl not found
r(111);
.
. label list statelbl;
value label statelbl not found
r(111);
.
. keep if state==0;
state not found
r(111);
.
.   *drop hpf_pdn;
.
.   *ren hpf_emp hpf_pdn;
.
. keep m ind state pdn wgbill hpf_pdn hpf_wgbill;
no variables defined
r(111);
.
. label list indlbl;
value label indlbl not found
r(111);
.
. ren ind indus;
no variables defined
r(111);
.
. gen industry=0;
0; invalid name
r(198);
.
. replace industry=1 if indus==30  | indus==6;*SELECT INDUSTRIES TO BE INCLUDED IN SAMP
> LE;
no variables defined
r(111);
.
. replace industry=2 if indus==315 | indus==2;
no variables defined
r(111);
.
. replace industry=3 if indus==335 | indus==4;
no variables defined
r(111);
.
. replace industry=4 if indus==334 | indus==5;
no variables defined
r(111);
.
. replace industry=5 if indus==336 | indus==3;
no variables defined
r(111);
.
. drop if industry==0;
industry not found
r(111);
.
. gen year=yofd(dofm(m));
Unknown function ()
r(133);
.
. gen month=month(dofm(m));
Unknown function ()
r(133);
.
. drop m;
no variables defined
r(111);
.
. sort year month industry;
no variables defined
r(111);
.
. save x0, replace;
option ; not allowed
r(198);
.
.
.
. use mx-filtered.dta;
invalid ';'
r(198);
.
. label list indlbl;
value label indlbl not found
r(111);
.
.   *drop hpf_obr;
.
.   *ren hpf_emp hpf_obr;
.
. keep m ind obr sal hpf_obr hpf_sal;
no variables defined
r(111);
.
. label list indlbl;
value label indlbl not found
r(111);
.
. ren ind indus;
no variables defined
r(111);
.
. gen industry=0;
0; invalid name
r(198);
.
. replace industry=1 if indus==30  | indus==6;*SELECT INDUSTRIES TO BE INCLUDED IN SAMP
> LE;
no variables defined
r(111);
.
. replace industry=2 if indus==315 | indus==2;
no variables defined
r(111);
.
. replace industry=3 if indus==335 | indus==4;
no variables defined
r(111);
.
. replace industry=4 if indus==334 | indus==5;
no variables defined
r(111);
.
. replace industry=5 if indus==336 | indus==3;
no variables defined
r(111);
.
. drop if industry==0;
industry not found
r(111);
.
. gen year=yofd(dofm(m));
Unknown function ()
r(133);
.
. gen month=month(dofm(m));
Unknown function ()
r(133);
.
. drop m;
no variables defined
r(111);
.
. sort year month industry;
no variables defined
r(111);
.
. merge year month industry using x0; tab _merge; drop if _merge~=3; drop _merge;
no variables defined
r(111);
.
. save x1, replace;
option ; not allowed
r(198);
.
.
.
. gen time=year+((month-1)/12);
year not found
r(111);
.
. label var time "Date";
no variables defined
r(111);
.
.   label var hpf_obr "Mexico Apparel"; label var hpf_pdn "US Apparel (NAICS 315)";
no variables defined
r(111);
.
. gr7 hpf_obr hpf_pdn time if year<2006 & indus==2, c(l[-]l) s(..) border ylab xlab(199
> 6,1998,2000,2002,2004,2006) saving(fig1a,replace);
no variables defined
r(111);
.
.   label var hpf_obr "Mexico Transport Equip."; label var hpf_pdn "US Transport Equip.
>  (NAICS 336)";
no variables defined
r(111);
.
. gr7 hpf_obr hpf_pdn time if year<2006 & indus==3, c(l[-]l) s(..) border ylab xlab(199
> 6,1998,2000,2002,2004,2006) saving(fig1b,replace);
no variables defined
r(111);
.
.   label var hpf_obr "Mexico Electrical Mach."; label var hpf_pdn "US Electrical Mach.
>  (NAICS 335)";
no variables defined
r(111);
.
. gr7 hpf_obr hpf_pdn time if year<2006 & indus==4, c(l[-]l) s(..) border ylab xlab(199
> 6,1998,2000,2002,2004,2006) saving(fig1c,replace);
no variables defined
r(111);
.
.   label var hpf_obr "Mexico Electronic Materials"; label var hpf_pdn "US Electronics
> (NAICS 334)";
no variables defined
r(111);
.
. gr7 hpf_obr hpf_pdn time if year<2006 & indus==5, c(l[-]l) s(..) border ylab xlab(199
> 6,1998,2000,2002,2004,2006) saving(fig1d,replace);
no variables defined
r(111);
.
. gr7 using fig1a fig1d fig1c fig1b, saving(fig1,replace);
file fig1a.gph not found
r(601);
.
.
.
. for num 0 1 2 : erase xX.dta;
->  erase x0.dta;
invalid ';'
r(198);
源程序:
drop _all
set more 1
macro drop _all
#delimit ;

*THIS FILE SHOWS SUMMARY STATS ON PRODUCTION WORKER EARNINGS AND EMPLOYMENT FOR ALL MANUFACTUING AND OUTSOURCING INDUSTRIES IN US AND MEXICO TO BE
USED FOR FIGURE 1 IN BFH PAPER. THE DATA USED FROM THE EXERCISE ARE SEASONALLY ADJUSTED, LOGGED, HP FILTERED DATA ON MEXICAN AND US INDUSTRIES.  
THE RESULTS ARE FOR THE BERGIN, FEENSTRA, HANSON AER PAPER;
use us-filtered.dta;
label list indlbl;
label list statelbl;
keep if state==0;
  *drop hpf_pdn;
  *ren hpf_emp hpf_pdn;
keep m ind state pdn wgbill hpf_pdn hpf_wgbill;
label list indlbl;
ren ind indus;
gen industry=0;
replace industry=1 if indus==30  | indus==6;   *SELECT INDUSTRIES TO BE INCLUDED IN SAMPLE;
replace industry=2 if indus==315 | indus==2;
replace industry=3 if indus==335 | indus==4;
replace industry=4 if indus==334 | indus==5;
replace industry=5 if indus==336 | indus==3;
drop if industry==0;
gen year=yofd(dofm(m));
gen month=month(dofm(m));
drop m;
sort year month industry;
save x0, replace;
use mx-filtered.dta;
label list indlbl;
  *drop hpf_obr;
  *ren hpf_emp hpf_obr;
keep m ind obr sal hpf_obr hpf_sal;
label list indlbl;
ren ind indus;
gen industry=0;
replace industry=1 if indus==30  | indus==6;   *SELECT INDUSTRIES TO BE INCLUDED IN SAMPLE;
replace industry=2 if indus==315 | indus==2;
replace industry=3 if indus==335 | indus==4;
replace industry=4 if indus==334 | indus==5;
replace industry=5 if indus==336 | indus==3;
drop if industry==0;
gen year=yofd(dofm(m));
gen month=month(dofm(m));
drop m;
sort year month industry;
merge year month industry using x0; tab _merge; drop if _merge~=3; drop _merge;
save x1, replace;
gen time=year+((month-1)/12);
label var time "Date";
  label var hpf_obr "Mexico Apparel"; label var hpf_pdn "US Apparel (NAICS 315)";
gr7 hpf_obr hpf_pdn time if year<2006 & indus==2, c(l[-]l) s(..) border ylab xlab(1996,1998,2000,2002,2004,2006) saving(fig1a,replace);
  label var hpf_obr "Mexico Transport Equip."; label var hpf_pdn "US Transport Equip. (NAICS 336)";
gr7 hpf_obr hpf_pdn time if year<2006 & indus==3, c(l[-]l) s(..) border ylab xlab(1996,1998,2000,2002,2004,2006) saving(fig1b,replace);
  label var hpf_obr "Mexico Electrical Mach."; label var hpf_pdn "US Electrical Mach. (NAICS 335)";
gr7 hpf_obr hpf_pdn time if year<2006 & indus==4, c(l[-]l) s(..) border ylab xlab(1996,1998,2000,2002,2004,2006) saving(fig1c,replace);
  label var hpf_obr "Mexico Electronic Materials"; label var hpf_pdn "US Electronics (NAICS 334)";
gr7 hpf_obr hpf_pdn time if year<2006 & indus==5, c(l[-]l) s(..) border ylab xlab(1996,1998,2000,2002,2004,2006) saving(fig1d,replace);
gr7 using fig1a fig1d fig1c fig1b, saving(fig1,replace);
for num 0 1 2 : erase xX.dta;
二维码

扫码加我 拉你入群

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

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

全部回复
2010-3-14 21:56:42
好长啊,不知道也不懂,希望有人给楼主解答
二维码

扫码加我 拉你入群

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

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

2010-3-14 22:53:07
同问,好复杂的问题。
二维码

扫码加我 拉你入群

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

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

2010-3-15 07:52:39
你上面的#delimit; 命名不能在command 窗口中执行,所以后面全部出错。

你的写在do文件中,然后在do文件中运行
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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