?2021年寒假Stata研讨班:高级计量经济学及Stata应用研讨班
?2021空间计量研讨班:空间计量及Geoda、Stata、ArcGis、Matlab应用
来源:综合整理自:http://dss.princeton.edu/training/
转载请注明来源
本文主要包括数据类型转换、自相关图、平稳性、协整、格兰杰检验等内容
1 From daily/monthly date variable to quarterly1、Quarterly date from daily date
导入数据,查看数据use date.dtadesced
可以发现Date2 is a string date variable
然后进行转换
gen datevar=date(date2,"MDY", 2099) format datevar %td gen quarterly = qofd(datevar) format quarterly %tq
2、Quarterly date from monthly date
gen month = month(datevar) gen day=day(datevar) gen year=year(datevar) gen monthly = ym(year,month) format monthly %tm
结果为:
2
From daily to weekly and getting yearly
gen datevar = date(date2, "MDY", 2099) format datevar %td gen year= year(datevar) gen w = week(datevar) gen weekly = yw(year,w) format weekly %tw browse
结果为:
From daily to yearly
gen year1 = year(datevar)