cd C:\贪玩\stata12
insheet using 72127.csv,double clear
drop in 1
drop v1
gen date_new=date(v2, "YMD")
format date_new %tdCCYYNNDD
gen countycode=72127
tostring date_new countycode,replace
replace countycode=substr("00000"+countycode,-5,.)
egen countydate=concat(countycode date_new)
save 72127,replace
insheet using 55079.csv,double clear
drop in 1
drop v1
gen date_new=date(v2, "YMD")
format date_new %tdCCYYNNDD
gen countycode=55079
tostring date_new countycode,replace
replace countycode=substr("00000"+countycode,-5,.)
egen countydate=concat(countycode date_new)
save 55079,replace
insheet using 55025.csv,double clear
drop in 1
drop v1
gen date_new=date(v2, "YMD")
format date_new %tdCCYYNNDD
gen countycode=55025
tostring date_new countycode,replace
replace countycode=substr("00000"+countycode,-5,.)
egen countydate=concat(countycode date_new)
save 55025,replace
总的数据有300个csv文件,一步步写太浪费时间了,有没有循环语句可以用?求大神支招!