<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Logistic Regression--calculate score_card in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Logistic-Regression-calculate-score-card/m-p/957120#M373660</link>
    <description>Maybe can show other code to calculate score and also learn how from estimate value calculate score . What is theory behind it</description>
    <pubDate>Fri, 24 Jan 2025 15:21:02 GMT</pubDate>
    <dc:creator>Ronein</dc:creator>
    <dc:date>2025-01-24T15:21:02Z</dc:date>
    <item>
      <title>Logistic Regression--calculate score_card</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Logistic-Regression-calculate-score-card/m-p/957113#M373658</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I want to calculate logistic regression model.&lt;/P&gt;
&lt;P&gt;The dependent variable is 1/0&amp;nbsp; (Default/non-Default)&lt;/P&gt;
&lt;P&gt;There are 2 predictors: Sex,Age (Each of them is a categorical variable).&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;Then I want to calculate score card for each variable and each category.&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;The code to calculate the scorecard is not clear for me (Someone sent it to me).&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;I want to ask if there is any other to calculate it?&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data raw_tbl;
input sex $ age bad @@;
cards;
2     1    1   1       2    0
1       2    0   2     2    0
2     3    0   2     2    0
1       3    0   1       2    1
2     1    1   2     1    0
2     2    0   2     3    0
1       2    1   2     3    0
2     2    1   1       3    1
1       1    1   2     2    0
1       3    0   1       2    1
1       3    0   2     2    0
2     2    0   2     1    0
2     1    1   2     3    0
2     2    0   2     2    0
1       1    0   1       1    0
2     1    0   1       1    0
2     3    1   2     2    0
1       3    0  2     2    1
2     1    0   2     2    0
2     1    0   2     2    0
;
Run;

proc sql;
select sex,
		count(*) as nr,
        sum(bad) as nr_bads,
		calculated nr_bads/calculated nr as pct_bads format=percent8.2
from raw_tbl
group by  sex
;
quit;

proc sql;
select age,
		count(*) as nr,
        sum(bad) as nr_bads,
		calculated nr_bads/calculated nr as pct_bads format=percent8.2
from raw_tbl
group by  age
;
quit;


proc format;
value Dependent_Fmt 
1 = 'Default' 
0 = 'No_Default';
run;
proc format;
value Sex_Fmt 
1 = 'Male' 
2 = 'Female';
run;
proc format;
value age_Fmt 
1 = 'Till_30' 
2 = '30-40'
3='40+'
;
run;

ods output parameterestimates=Coef_tbl;
proc genmod data=raw_tbl namelen=60 descending ;
class  sex age;
model bad=sex age/ dist=binomial link=logit  type3 wald ;
store MyModel;
output out=raw_data_with_predict  p=P_subscibe xbeta=logit;
/*ODS SELECT ModelANOVA;*/
run;
/**Create data set row_data_with_predict that have row data with predict colmn called :P_subscibe***/

/***Show the coefficents in a data set***/
proc plm source=MyModel;
show parameters;
run;
 
Data est;
set Coef_tbl;
IF Parameter in ('Intercept','Scale') then delete;
Run;


proc sort data=est(KEEP=Parameter Level1 Estimate ProbChiSq) out=est2;
by Parameter Estimate;
Run;


Data est3;
set est2 end=last;
by Parameter Estimate;
retain factor 1 max_s 0 n 0;
odds=exp(Estimate);
if first.Parameter and Estimate&amp;lt;1 then do;
n=n+1;
new_odds=1;
factor=1/odds;
end;
if not first.Parameter then new_odds=factor*odds;
lnodds=LOG(new_odds);
if last.Parameter then do;
factor=1;
max_s=max_s+lnodds;
end;
if last then do;
call symput('max_s',max_s);
call symput('n_var',n);
end;
drop factor;
Run;


data score_card;
set est3;
by Parameter Estimate;
_score_c=lnodds*(1000/&amp;amp;max_s.);
score_c=round(_score_c,1);
KEEP parameter Level1 Estimate ProbChiSqe score_c;
Run;
proc sort data=score_card;
by Parameter level1;
Run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Jan 2025 14:17:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Logistic-Regression-calculate-score-card/m-p/957113#M373658</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2025-01-24T14:17:22Z</dc:date>
    </item>
    <item>
      <title>Re: Logistic Regression--calculate score_card</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Logistic-Regression-calculate-score-card/m-p/957118#M373659</link>
      <description>What part is not clear?</description>
      <pubDate>Fri, 24 Jan 2025 15:09:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Logistic-Regression-calculate-score-card/m-p/957118#M373659</guid>
      <dc:creator>quickbluefish</dc:creator>
      <dc:date>2025-01-24T15:09:01Z</dc:date>
    </item>
    <item>
      <title>Re: Logistic Regression--calculate score_card</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Logistic-Regression-calculate-score-card/m-p/957120#M373660</link>
      <description>Maybe can show other code to calculate score and also learn how from estimate value calculate score . What is theory behind it</description>
      <pubDate>Fri, 24 Jan 2025 15:21:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Logistic-Regression-calculate-score-card/m-p/957120#M373660</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2025-01-24T15:21:02Z</dc:date>
    </item>
    <item>
      <title>Re: Logistic Regression--calculate score_card</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Logistic-Regression-calculate-score-card/m-p/957150#M373661</link>
      <description>&lt;P&gt;There have been books and web sites written on the subject of creating and calculating score cards. That's probably a better place for you to start than to expect us to go over such a huge topic here in the forums.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jan 2025 16:42:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Logistic-Regression-calculate-score-card/m-p/957150#M373661</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2025-01-24T16:42:37Z</dc:date>
    </item>
    <item>
      <title>Re: Logistic Regression--calculate score_card</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Logistic-Regression-calculate-score-card/m-p/957181#M373670</link>
      <description>Is there not a sas procedure to calculate it?</description>
      <pubDate>Fri, 24 Jan 2025 20:45:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Logistic-Regression-calculate-score-card/m-p/957181#M373670</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2025-01-24T20:45:31Z</dc:date>
    </item>
    <item>
      <title>Re: Logistic Regression--calculate score_card</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Logistic-Regression-calculate-score-card/m-p/957221#M373690</link>
      <description>&lt;P&gt;You have ignored the questions that have been asked and ignored the advice to search the resources described. Please answer the questions from &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/223320"&gt;@quickbluefish&lt;/a&gt; and as suggested do an internet search on this. Please, don't keep asking your question in different ways as a replacement for providing the information asked for or following the advice that has been given.&lt;/P&gt;</description>
      <pubDate>Sat, 25 Jan 2025 10:42:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Logistic-Regression-calculate-score-card/m-p/957221#M373690</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2025-01-25T10:42:30Z</dc:date>
    </item>
    <item>
      <title>Re: Logistic Regression--calculate score_card</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Logistic-Regression-calculate-score-card/m-p/957243#M373701</link>
      <description>&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/WOE-IV-and-Evolution-of-AI-Driven-Credit-Scoring-Models/ta-p/949855" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/WOE-IV-and-Evolution-of-AI-Driven-Credit-Scoring-Models/ta-p/949855&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/A-n00b-s-Guide-to-Decrypting-Credit-Scoring/ta-p/943475" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/A-n00b-s-Guide-to-Decrypting-Credit-Scoring/ta-p/943475&lt;/A&gt;</description>
      <pubDate>Sun, 26 Jan 2025 06:33:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Logistic-Regression-calculate-score-card/m-p/957243#M373701</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-01-26T06:33:50Z</dc:date>
    </item>
  </channel>
</rss>

