data a;
input index code year x1 x2 x3;
cards;
102003 10 2003 1 2 3
102003 10 2003 2 2 3
102004 10 2004 1 4 5
102005 10 2005 2 4 5
102006 10 2006 1 6 7
102006 10 2006 2 7 8
122003 12 2003 1 8 9
122004 12 2004 2 9 10
122005 12 2005 1 10 11
122005 12 2005 2 10 11
122006 12 2006 1 11 12
142004 14 2004 1 12 13
142005 14 2005 2 13 14
162005 16 2005 1 14 15
162006 16 2006 2 15 16
;run;
data b;
input index code year y1 y2 y3;
cards;
102003 10 2003 1 2 3
102004 10 2004 2 3 4
102005 10 2005 3 4 5
102006 10 2006 4 5 6
122003 12 2003 5 6 7
122004 12 2004 6 7 8
122005 12 2005 7 8 9
122006 12 2006 8 9 10
152004 15 2004 1 2 3
162004 16 2004 2 3 4
172005 17 2005 3 4 5
;run;proc sort data=b;by code year;run;
data new;set a;
by code year;
if first.code then n=0;
if first.year then n=0;
n+1;if n=1 then output;
drop n;run;
data c;merge new b;by code year;run;
proc sql;create table d as
select * from new as cross join b
on new.code=b.code and new.year=b.year; quit;


雷达卡



京公网安备 11010802022788号







