<?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 Facing Issue while calculating the Loan Default Percentage from the available data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Facing-Issue-while-calculating-the-Loan-Default-Percentage-from/m-p/437733#M109055</link>
    <description>&lt;P&gt;Hi There,&lt;/P&gt;&lt;DIV&gt;I'm trying to calculate the default value from the available data. I have merged the data by using following code&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Data Loan_1;&lt;/DIV&gt;&lt;DIV&gt;Set 36_Months 60 Months;&lt;/DIV&gt;&lt;DIV&gt;Run;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Then I have sorted the data using proc sort&lt;/DIV&gt;&lt;DIV&gt;After that i have created a variable named Loan_Status2 in which I have created to values 1st is Current and 2nd is default using following code&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Data Loan_11;&lt;/DIV&gt;&lt;DIV&gt;Set Loan_1;&lt;/DIV&gt;&lt;DIV&gt;If loan_Status = 'Late (31-120 Days)' or Loan_Status = 'Default' then Loan_Status2 = 1;&lt;/DIV&gt;&lt;DIV&gt;Else If&amp;nbsp;&lt;SPAN style="box-sizing: border-box; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif, 'Helvetica Neue', Helvetica, Arial, sans-serif;"&gt;loan_Status = 'Current' or&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="box-sizing: border-box; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif, 'Helvetica Neue', Helvetica, Arial, sans-serif;"&gt;loan_Status = 'Late (16-30 Days)' or&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="box-sizing: border-box; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif, 'Helvetica Neue', Helvetica, Arial, sans-serif;"&gt;loan_Status = 'In Grace Period' or&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="box-sizing: border-box; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif, 'Helvetica Neue', Helvetica, Arial, sans-serif;"&gt;loan_Status = 'Charged Off' or&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="box-sizing: border-box; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif, 'Helvetica Neue', Helvetica, Arial, sans-serif;"&gt;loan_Status = 'Fully Paid'&amp;nbsp; then&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="box-sizing: border-box; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif, 'Helvetica Neue', Helvetica, Arial, sans-serif;"&gt;loan_Status2 = 0;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;After this I'm trying to calculate the default % by using following code&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;Data Loan_111;&lt;/DIV&gt;&lt;DIV&gt;Set Loan_11;&lt;/DIV&gt;&lt;DIV&gt;DefaultLoan&amp;nbsp; = (Sum (1)/Sum(Loan_Status2));&lt;/DIV&gt;&lt;DIV&gt;Format DefaultLoan $Char20.;&lt;/DIV&gt;&lt;DIV&gt;Proc Print;&lt;/DIV&gt;&lt;DIV&gt;Run;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;But getting wrong output&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;please do the needful.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards,&lt;/DIV&gt;&lt;DIV&gt;Roshan Malewar&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 15 Feb 2018 19:30:51 GMT</pubDate>
    <dc:creator>Malewar</dc:creator>
    <dc:date>2018-02-15T19:30:51Z</dc:date>
    <item>
      <title>Facing Issue while calculating the Loan Default Percentage from the available data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Facing-Issue-while-calculating-the-Loan-Default-Percentage-from/m-p/437733#M109055</link>
      <description>&lt;P&gt;Hi There,&lt;/P&gt;&lt;DIV&gt;I'm trying to calculate the default value from the available data. I have merged the data by using following code&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Data Loan_1;&lt;/DIV&gt;&lt;DIV&gt;Set 36_Months 60 Months;&lt;/DIV&gt;&lt;DIV&gt;Run;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Then I have sorted the data using proc sort&lt;/DIV&gt;&lt;DIV&gt;After that i have created a variable named Loan_Status2 in which I have created to values 1st is Current and 2nd is default using following code&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Data Loan_11;&lt;/DIV&gt;&lt;DIV&gt;Set Loan_1;&lt;/DIV&gt;&lt;DIV&gt;If loan_Status = 'Late (31-120 Days)' or Loan_Status = 'Default' then Loan_Status2 = 1;&lt;/DIV&gt;&lt;DIV&gt;Else If&amp;nbsp;&lt;SPAN style="box-sizing: border-box; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif, 'Helvetica Neue', Helvetica, Arial, sans-serif;"&gt;loan_Status = 'Current' or&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="box-sizing: border-box; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif, 'Helvetica Neue', Helvetica, Arial, sans-serif;"&gt;loan_Status = 'Late (16-30 Days)' or&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="box-sizing: border-box; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif, 'Helvetica Neue', Helvetica, Arial, sans-serif;"&gt;loan_Status = 'In Grace Period' or&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="box-sizing: border-box; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif, 'Helvetica Neue', Helvetica, Arial, sans-serif;"&gt;loan_Status = 'Charged Off' or&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="box-sizing: border-box; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif, 'Helvetica Neue', Helvetica, Arial, sans-serif;"&gt;loan_Status = 'Fully Paid'&amp;nbsp; then&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="box-sizing: border-box; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif, 'Helvetica Neue', Helvetica, Arial, sans-serif;"&gt;loan_Status2 = 0;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;After this I'm trying to calculate the default % by using following code&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;Data Loan_111;&lt;/DIV&gt;&lt;DIV&gt;Set Loan_11;&lt;/DIV&gt;&lt;DIV&gt;DefaultLoan&amp;nbsp; = (Sum (1)/Sum(Loan_Status2));&lt;/DIV&gt;&lt;DIV&gt;Format DefaultLoan $Char20.;&lt;/DIV&gt;&lt;DIV&gt;Proc Print;&lt;/DIV&gt;&lt;DIV&gt;Run;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;But getting wrong output&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;please do the needful.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards,&lt;/DIV&gt;&lt;DIV&gt;Roshan Malewar&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 19:30:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Facing-Issue-while-calculating-the-Loan-Default-Percentage-from/m-p/437733#M109055</guid>
      <dc:creator>Malewar</dc:creator>
      <dc:date>2018-02-15T19:30:51Z</dc:date>
    </item>
    <item>
      <title>Re: Facing Issue while calculating the Loan Default Percentage from the available data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Facing-Issue-while-calculating-the-Loan-Default-Percentage-from/m-p/437753#M109067</link>
      <description>&lt;P&gt;First, let's assume that you have working code that accurately creates the data set LOAN_11.&amp;nbsp; There are several areas where the syntax is questionable, so it may have been copied incorrectly in the posted code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The SUM function does not summarize across observations.&amp;nbsp; It sums up within a single observation only.&amp;nbsp; To get the rate that you are asking for, I would guess you are looking for:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc means data=loan_11 mean;&lt;/P&gt;
&lt;P&gt;var loan_status2;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The mean value for LOAN_STATUS2 will be the percent of loans that are in default.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As a general rule, think about using a procedure, not a DATA step, to summarize across observations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 20:08:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Facing-Issue-while-calculating-the-Loan-Default-Percentage-from/m-p/437753#M109067</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-02-15T20:08:30Z</dc:date>
    </item>
    <item>
      <title>Re: Facing Issue while calculating the Loan Default Percentage from the available data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Facing-Issue-while-calculating-the-Loan-Default-Percentage-from/m-p/437824#M109100</link>
      <description>&lt;P&gt;If you have listed all of the values for loan_status in your code you might find this interesting.&lt;/P&gt;
&lt;PRE&gt;proc format;
value $default
 'Late (31-120 Days)', 'Default'  ='In Default'
 'Current', 'Late (16-30 Days)', 'In Grace Period', 
 'Charged Off', 'Fully Paid'  = 'Not Default'
 ;
 run;

proc freq data=Loan_1;
   tables loan_status;
   format loan_status $default.;
run;
&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Feb 2018 23:37:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Facing-Issue-while-calculating-the-Loan-Default-Percentage-from/m-p/437824#M109100</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-02-15T23:37:24Z</dc:date>
    </item>
    <item>
      <title>Facing Issue while calculating the Loan Default Percentage from the available data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Facing-Issue-while-calculating-the-Loan-Default-Percentage-from/m-p/437938#M109141</link>
      <description>&lt;P&gt;Thank you very much Super User. It worked fine.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Feb 2018 11:23:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Facing-Issue-while-calculating-the-Loan-Default-Percentage-from/m-p/437938#M109141</guid>
      <dc:creator>Malewar</dc:creator>
      <dc:date>2018-02-16T11:23:58Z</dc:date>
    </item>
  </channel>
</rss>

