I have a problem when I am doing sums of two values from other tables. I only count one (active) even though it is also expired
proc sql;
create table policy_vintage_weekly1 as
select
policy_vintage
,count(NRB) as EXPIRED
from PolisyEnd
where POLISA_INFORMACJA = "W"
group by policy_vintage
;
quit;
proc sql;
create table policy_vintage_weekly2 as
select
policy_vintage
,count(NRB) as ACTIVE
from PolisyEnd
where POLISA_INFORMACJA = "A"
group by policy_vintage
;
quit;
proc sql;
create table graphbar as
select
sum(ak.ACTIVE) as ACTIVE
,sum(wy.EXPIRED) as EXPIRED
from policy_vintage_weekly2 ak
left join policy_vintage_weekly1 wy
on wy.policy_vintage = ak.policy_vintage
;
quit;