ssc install todate
如何网络下载包有卡,则下载以下包,手动安装之。
net install todate, replace from(c:\todate)
如果出现:
c:\git\todate\ either
1) does not exist or
2) is not a Stata download directory (has no stata.toc file).
current site is still http://fmwww.bc.edu/RePEc/bocode/t/则下载第二个含stata.toc的包
解压后安装:
net install todate, replace from(c:\todate)
然后:
clear
cd D:\....\uscar232
insheet using 1996201909calculateddutiesusimportcars.csv,names case clear
rename (Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec) ///
(v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11 v12)
reshape long v, i(year CID) j(month)
//save import, replace
rename v carduties
label variable carduties "duties of autoes and parts"
egen date=concat(month year),decode
destring date,replace
format date %07.0f
todate date, gen(datevar) pattern(mmyyyy)
drop date
rename month months
rename datevar month
encode Country,g(nation)
save "D:\.....\uscar232\1996201909monthsusimcarsduties.dta"