1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
proc sql;
create table c1 as (select distinct a1.id_mois, a1.id_tie_mkt, b.MT_CC_CUM_MVT_CRD_REEl_12_M ,
c.MT_CC_CUM_MVT_DBT_REEL_12_M ,
d.MT_CC_IMP_12_M ,
e.MT_CC_ENC_12_M ,
f.MT_CC_ESC_12_M ,
g.MT_CC_FLU_IM_12M
from (select a.id_mois,a.id_tie_mkt,a.id_ind,(b1.MT_M + a.MT_M1
+ a.MT_M2 + a.MT_M3 + a.MT_M4 + a.MT_M5 + a.MT_M6 + a.MT_M7 + a.MT_M8 + a.MT_M9 + a.MT_M10 + a.MT_M11 ) as MT_TOT
from temp.dedoub_step1_500 a,temp.dedoub_step12_500 b1 where
a.id_tie_mkt=b.id_tie_mkt and a.id_ind=b.id_ind) as a1 ,
a1 left join (select distinct
id_mois,id_tie_mkt,MT_tot as MT_CC_CUM_MVT_CRD_REEl_12_M
from a1 where id_ind=49) b on a1.id_mois=b.id_mois and a1.id_tie_mkt = b.id_tie_mkt
left join
(select distinct id_mois,id_tie_mkt,MT_tot as MT_CC_CUM_MVT_DBT_REEL_12_M
from a1 where id_ind=50) c on a1.id_mois=c.id_mois and a1.id_tie_mkt = c.id_tie_mkt
left join
(select distinct id_mois,id_tie_mkt,MT_tot as MT_CC_IMP_12_M
from a1 where id_ind=61) d on a1.id_mois=d.id_mois and a1.id_tie_mkt = d.id_tie_mkt
left join
(select distinct id_mois,id_tie_mkt,MT_tot as MT_CC_ENC_12_M
from a1 where id_ind=62) e on a1.id_mois=e.id_mois and a1.id_tie_mkt = e.id_tie_mkt
left join
(select distinct id_mois,id_tie_mkt,MT_tot as MT_CC_ESC_12_M
from a1 where id_ind=63) f on a1.id_mois=f.id_mois and a1.id_tie_mkt = f.id_tie_mkt
left join
(select distinct id_mois,id_tie_mkt,MT_tot as MT_CC_FLU_IM_12M
from a1 where id_ind=73) g on a1.id_mois=g.id_mois and a1.id_tie_mkt = g.id_tie_mkt );
quit; |
Partager