文章预览
来源:综合整理自:http://dss.princeton.edu/training/ 转载请注明来源 本文主要包括数据类型转换、自相关图、平稳性、协整、格兰杰检验等内容 1 From daily/monthly date variable to quarterly 1、Quarterly date from daily date 导入数据,查看数据 use date.dta desc ed 可以发现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) From quarterly to yearly gen year2 = yofd(
………………………………