以下是我写的一段程序:
forvalues i=1998/2007{
disp "File `i'"
use "original_`i'.dta",clear
gen id_in_source=_n
if `i'==2003{
gen town=address
}
if `i'==2011{
gen town=address
}
if year<2004{
gen revenue=sales_revenue
}
else{
gen revenue=operating_revenue
}
gen profit=total_profit
keep id_in_source firm_id firm_name industry legal_person occupation town ///
address place1 place2 place3 province rural telephone extension ///
fax extension1 zip product1 product2 product3 cic ///
system register sharehold relationship founding_year founding_month ///
status level activity primary second construction transportation ///
catering other scale retail light_heavy employment output1 output2 ///
new_output sale_output exported added_value current_assets ///
net_accounts stocks products average_balance_current_assets ///
long_term_invesment fixed_assets original_price production_operation ///
acc_depreciation depreciation average_balance_fixed_assets ///
intangible_deferred intangible_assets total_assets current_liabilities ///
long_liabilities total_liabilities equity recovery_capital state ///
collective legal personal hk_macao_taiwan foreign sales_revenue ///
sales_cost sales_expenses salex_tax sales_profit other_profit ///
management_expenses tax property_insurance insurance ///
financial_expenses interest_expenses operating_profit subsidy ///
total_profit total_loss total_profit_tax income_tax to_profit ///
wage main_business welfare main_business_walfare VAT input_tax ///
output_tax mediam_input year
destring founding_year employment revenue profit,replace force
tostring cic,replace format(%04.0f)
rename firm_id id
rename firm_name name
rename founding_year bdat
rename region_code dq
rename product1 product1_
rename telephone phone
foreach var of varlist *{
rename `var' `var'`i'
}
compress
saveold m`i'.dta,replace
}
我自认为自己写的程序没有问题,昨天运行也没有问题,但是今天运行却告诉我“variable revenue not found”,按照命令revenue=sales_revenue/operating_revenue(两个变量data文件都有),但是循环却无法生成“revenue”;去掉循环用gen revenue=sales_revenue是没有问题的,不知道怎么回事?求教


雷达卡




京公网安备 11010802022788号







