I wanted to add a case when WPIS_ where if frm_code is one of the codes mentioned then we ASSIGNY W if not then B. I get "Syntax error" what I do wrong Rest code is working
PROC SQL;
create table PolisyEnd as
select distinct
t1.data_danych as data_danych
,t4.spr_NRB as NRB
,intnx('month',datepart(t1.PRP_END_DATE),0,'b') format=yymmd7. as POLICY_VINTAGE,
case
when datepart(t1.PRP_END_DATE) IS NOT NULL and datepart(t1.PRP_END_DATE) - &gv_date_dly. < 0 THEN 'W'
when datepart(t1.PRP_END_DATE) IS NOT NULL and datepart(t1.PRP_END_DATE) - &gv_date_dly. > 0 THEN 'A'
when datepart(t1.PRP_END_DATE) IS NULL THEN 'NO INFO'
end as POLISA_INFORMACJA
case
when t5.frm_code = 'C11' then 'W'
and t5.frm_code = 'A11' then 'W'
and t5.frm_code ='C30' then 'W'
and t5.frm_code 'ZH1' then 'W'
else 'B'
end as WPIS_
from
cmz.WMDTZDP_BH t1
CodePudding user response:
As @HoneyBadger noted, there should be a comma after the first case
statement.
Also there is 'and' instead of 'when' 3 times in the second case
statement.
It looks like '=' is missing in t5.frm_code 'ZH1' then 'W'
.
There must also be a semi-colon at the very end.