Hi Expert,
Has anyone got any code to convert categorical variables value into WOE?
Thanks
WOE?
Please post more details.
If you actually mean "Weight of Evidence", start here: Computing the Weight of Evidence and Information Value - SAS Help Center
This is the first result of a Google search for "sas weight of evidence", see Maxim 6.
Here is .Also calculated IV .
%let var=marital ;
title "变量: &var";
proc sql;
create table woe_&var as
select &var as group,
sum(good_bad='bad') as n_bad label='bad的个数',sum(good_bad='good') as n_good label='good的个数',
sum(good_bad='bad')/(select sum(good_bad='bad') from have ) as bad_dist format=percent7.2 label='bad的占比',
sum(good_bad='good')/(select sum(good_bad='good') from have ) as good_dist format=percent7.2 label='good的占比',
log(calculated Bad_Dist/calculated Good_Dist) as woe
from have
group by &var
order by woe;
select *,sum( (Bad_Dist-Good_Dist)*woe ) as iv
from woe_&var ;
quit;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.