SAS中文论坛

标题: 有没有简单的quarterly data变monthly的方法? [打印本页]

作者: shiyiming    时间: 2011-1-24 15:58
标题: 有没有简单的quarterly data变monthly的方法?
我有quarterly data(每个季度末report),想要monthly data,中间月份用线性插值(linear interpolation),有没有简单的方法?谢谢!

数据形式大约为:
firm date at
A    20090331  89
A    20090630  100
A    20090930   85
B    20080630    4
B    20080930    10


我用expand但是总是出错。
proc sort data=temp; by firm date; run;
proc expand data=temp out=temp1 from=qtr to=month;
      convert at / observed = total;
      by firm;
      id date;
run;
作者: shiyiming    时间: 2011-1-24 16:52
标题: Re: 有没有简单的quarterly data变monthly的方法?
发现问题,不同公司的季度末日期经常变化,所以没法用expand。比如会出现

firm  date    at
C     20091031   80
C     20091231   90

ERROR:Duplicate time interval found at observation number 135 in the data set WORK.TEMP, according
       to the FROM=QTR option and the ID variable values. The current ID is date=20091231 and the
       previous is datadate=20091031, which are within the same QTR interval.

有什么好办法么?




欢迎光临 SAS中文论坛 (http://mysas.net/forum/) Powered by Discuz! X3.2