1%macro irmst_apply_yield_calculations( map_movement_type =
6 %let j = %eval(&activationHorizon.-1);
11 create table work.bep_yld_dtls as
17 , coalescec(t2.value_src,yld_value_src) as value_src
19 from work.yldassump (rename=(value_src=yld_value_src))
20 where activationHorizon = &activationHorizon.) t1
21 left join work.vol_aggregate t2
22 on t1.account_cd = t2.account_cd
33 sum(cash_flow_src_percent) as sum_cash_percent,
34 sum(non_cash_flow_src_percent) as sum_noncash_percent
42 data work.bep_yld_posting;
44 posting_group_id length = $50. label = "Posting Group Id"
45 movement_id length = 8. label = "Movement Id"
46 movement_desc length = $100. label = "Movement Description"
47 %irm_get_attrib_def(ds_in = &map_movement_type.)
50 set work.bep_yld_dtls;
53 posting_group_id = cats('YLD_',account_cd);
57 declare hash hMvmt(dataset: "&map_movement_type.");
58 hMvmt.defineKey("movement_type_cd");
59 hMvmt.definedata("movement_type", "movement_category");
63 declare hash perTotLookup(dataset: "work.fundSourceTotals");
64 perTotLookup.defineKey("account_cd");
65 perTotLookup.definedata("sum_cash_percent","sum_noncash_percent");
66 perTotLookup.defineDone();
70 movement_type_cd = "BS_MODEL";
71 movement_desc = "Yield Assumptions";
76 if value_src = 'external_model' then do;
78 var = (sum(amount_model,amountT&j.)/2)*(sum(yield_bb,yield_fb)/2);
81 var = sum((amountT&j.+bbook)/2*yield_bb,(fbook/2)*yield_fb);
83 if first.account_cd then do;
84 posting_account_id = account_cd;
85 variation = var*(1-cashflow_rate);
89 call missing(sum_cash_percent);
90 call missing(sum_noncash_percent);
91 _rc_= perTotLookup.find();
93 sum_cash_percent = 100;
94 sum_noncash_percent = 100;
98 if cash_flow_src_source ne '' then do;
99 posting_account_id = cash_flow_src_source;
100 variation = -var*cash_flow_src_percent / sum_cash_percent;
105 if non_cash_flow_src_source ne '' then do;
106 posting_account_id = non_cash_flow_src_source;
107 variation = (var*cashflow_rate)*non_cash_flow_src_percent / sum_noncash_percent;
114 create table work.yld_aggregate as
121 , sum(t2.amountT&j. ,t2.vol_variation ,t3.yld_variation) as prelim_total
122 from (select distinct account_id
124 from &actualsData.) t1
125 left join (select distinct account_id
131 from work.vol_aggregate) t2
132 on t1.account_cd=t2.account_cd
133 left join (select posting_account_id
134 , sum(variation) as yld_variation
135 from work.bep_yld_posting
136 group by posting_account_id) t3
137 on t1.account_cd=t3.posting_account_id
140%mend irmst_apply_yield_calculations;