向高手求助,我用procsql来筛选使需要回归的指数的日期相对应,但是第一组数据(000300与000914)结果正常,第二组数据(000300与000951)查询结果却有重复数据了(比如,2010-1-1日的回报率会出现两次),刚学SAS没多久,不知道为什么啊!
我的程序如下:
/*对000300与000914根据时间进行数据筛选*/
proc sql;
create table temp1 as
select index000300.idxtrd01,index000300.idxtrd08
from index000300,index000914
where index000300.idxtrd01= index000914.idxtrd01;
run;
proc sql;
create table temp2 as
select index000914.idxtrd01,index000914.idxtrd08
from index000914,temp1
where index000914.idxtrd01= temp1.idxtrd01;
run;
proc sql;
create table temp3 as
select index000300.idxtrd01,index000300.idxtrd08
from index000300,temp2
where index000300.idxtrd01= temp2.idxtrd01;
run;
quit;
data temp2;
set temp2;
rename idxtrd08=r000914;
attrib r000914 label='r000914';
run;
data temp3;
set temp3;
rename idxtrd08=r000300;
attrib r000914 label='r000300';
drop idxtrd01
run;
data index300914;
merge temp2 temp3;
run;
quit;
/*对000300与000951根据时间进行筛选*/
proc sql;
create table temp1 as
select index000300.idxtrd01,index000300.idxtrd08
from index000300,index000951
where index000300.idxtrd01= index000951.idxtrd01;
run;
proc sql;
create table temp2 as
select index000951.idxtrd01,index000951.idxtrd08
from index000951,temp1
where index000951.idxtrd01= temp1.idxtrd01;
run;
proc sql;
create table temp3 as
select index000300.idxtrd01,index000300.idxtrd08
from index000300,temp2
where index000300.idxtrd01= temp2.idxtrd01;
run;
quit;
data temp2;
set temp2;
rename idxtrd08=r000951;
attrib r000951 label= 'r000951';
run;
data temp3;
set temp3;
rename idxtrd08=r000300;
attrib r000300 label= 'r000300';
drop idxtrd01;
run;
data index300951;
merge temp2 temp3;
run;
其中idxtrd01是时间,idxtrd08是回报率