Hello everyone. Trying to figure out what code to use for the following logic. From the dataset created by the code below, I want to exclude rows where the value of dealer_state = the value of customer_state or states adjacent to the dealer_state. For example, if the dealer_state = 'OH', I would want to exclude rows where customer_state = 'OH','KY','IN','MI','WV' and 'PA'. I'm ok with hardcoding the exclusions, but don't know what that code would be. I'm using SAS 7.1 on Windows. Any suggestions? Thanks in advance!
proc sql;
create table New_Apps as select
a.application_id ,a.received_date, a.booking_date,a.market_value,
a.application_status,a.product_type,a.collateral_type, a.initial_decision_user_id,
b.dealer_state, c.customer_state, c.ssn
from ilos.application a
left join ilos.company_dealer b
on a.dealer_id = b.dealer_id
left join ilos.application_search c
on a.application_id = c.application_id
where year(datepart(received_date)) > 2014 and
/* if b.dealer_state = 'OH' and c.customer_state not in (OH);*/
;quit;