| 
 | 
板凳
 
 
 楼主 |
发表于 2013-1-4 02:56:04
|
只看该作者
 
 
 
Re: 如何补充数据
[code:1mw391v3]data a; 
input year id price; 
   yi=catx('_',year,id); 
cards; 
1998 1 10 
1999 1 12 
2000 1 11.5 
1998 2 11 
1999 2 11.5 
2000 2 12 
; 
data b;  
do id=1 to 2; 
 do year=1995 to 2005; 
   yi=catx('_',year,id); 
   output; 
   end; 
 end; 
run; 
proc sql; 
 create table ab(drop=yi) as 
  select d1.*, d2.price from b d1 left join a d2 
   on d1.yi=d2.yi 
   order by id,year; 
quit;[/code:1mw391v3] |   
 
 
 
 |