之前用data步处理了一遍数据……好像太长了呃………………T_T
data a;
input dep $ mon $ yj;
cards;
01 一月 8
02 一月 10
02 二月 9
03 一月 7
03 三月 6
04 三月 11
;
run;
data b;
do dep='01','02', '03','04';
do mon='一月', '二月', '三月';
yj=.;
output;
end;
end;
run;
data c(keep=dep mon yj);
retain p1 1;
retain p2 1;
set b point=p2 ;
b_dep=dep; b_mon=mon;
set a point=p1 nobs=t;
a_dep=dep; a_mon=mon;
if a_dep=b_dep & a_mon=b_mon then output;
else do;
dep=b_dep; mon=b_mon; yj=.; output;
p1=p1-1;
end;
p1=p1+1;p2=p2+1;
if p1>t then stop;
run;
proc sql;
create table d as
(select * from (a join b
on a.dep=b.dep) );
quit;
data b;
length dep $8 name $30;
input dep $ name$;
cards;
01 国内营业部1
02 国内营业部2
03 国内营业部3
04 国际营业部
;
run;
proc sql;
select m.dep,name, m.yj '一月业绩',n.yj '二月业绩 ',k.yj '三月业绩'
from c m,c n,c k ,b
where m.dep=n.dep and n.dep=k.dep
and m.mon='一月' and n.mon='二月' and k.mon='三月' and m.dep=b.dep;
quit;


雷达卡
恩恩,好好学习一下,我刚开始学,data步 sql各种综合,我的好好看看!谢谢了啊
京公网安备 11010802022788号







