假定你把所有文件都存为了stata文档
use file1, clear
forvalues i=2/500 {
append using file`i'
}
save temp, replace
forvalues i=2001/2005 { //嘉定你的年份是介于2001与2005
keep id item `i'
gen year=`i'
save temp_`i', replace
}
use temp_2001, clear
forvalues i=2002/2005 {
append using temp_`i'
}
save final, replace
最后的效果你自己考虑,reshape或者转置都可以 ...