1%macro irmst_apply_value_calculations( map_movement_type =
6 %let j = %eval(&activationHorizon.-1);
11 create table bep_val_dtls as
16 where activationHorizon=&activationHorizon.) t1
17 left join work.yld_aggregate t2
18 on t1.account_cd=t2.account_cd
29 sum(oci_acct_percent) as sum_oci_percent
37 data work.bep_val_posting;
39 posting_group_id length = $50. label = "Posting Group Id"
40 movement_id length = 8. label = "Movement Id"
41 movement_desc length = $100. label = "Movement Description"
42 %irm_get_attrib_def(ds_in = &map_movement_type.)
45 set work.bep_val_dtls;
48 posting_group_id = cats('VAL_',account_cd);
52 declare hash hMvmt(dataset: "&map_movement_type.");
53 hMvmt.defineKey("movement_type_cd");
54 hMvmt.definedata("movement_type", "movement_category");
58 declare hash perTotLookup(dataset: "work.fundSourceTotals");
59 perTotLookup.defineKey("account_cd");
60 perTotLookup.definedata("sum_oci_percent");
61 perTotLookup.defineDone();
64 movement_type_cd = "BS_MODEL";
65 movement_desc = "Value Assumptions";
70 var = prelim_total * value_adjust;
71 if first.account_cd then do;
72 posting_account_id = account_cd;
78 call missing(sum_oci_percent);
79 _rc_= perTotLookup.find();
80 if _rc_ ne 0 then sum_oci_percent = 100;
82 posting_account_id = oci_acct_source;
83 variation = -var * oci_acct_percent / sum_oci_percent;
89 create table fsStructureT&activationHorizon. as
95 ,t2.amount_model as model_result
97 when t1.fs_type = 'PL'
98 then sum(t2.vol_variation,t3.yld_variation,t4.val_variation)
99 when t1.fs_type = 'BS' and strip(t1.accnt_type) in ('02. Liabilities','03. Equity')
100 then sum(t2.amountT&j.,-t2.vol_variation,-t3.yld_variation,-t4.val_variation)
101 else sum(t2.amountT&j.,t2.vol_variation,t3.yld_variation, t4.val_variation)
102 end as amountT&activationHorizon.
103 , &activationHorizon. as activationHorizon
104 from (select distinct account_id
108 from &actualsData.) t1
109 left join (select distinct account_id
114 from work.vol_aggregate) t2
115 on t1.account_cd=t2.account_cd
116 left join (select account_id
119 from work.yld_aggregate) t3
120 on t1.account_cd=t3.account_cd
121 left join (select posting_account_id
122 , sum(variation) as val_variation
123 from work.bep_val_posting
124 group by posting_account_id) t4
125 on t1.account_cd=t4.posting_account_id
128%mend irmst_apply_value_calculations;