Probability of default long run adjustment

Reply
New User
Posts: 1

Probability of default long run adjustment

Hi all

 

I am writing the code for the long run adjustment for probability of default model and the code fails to run.

 

Would you be so kind to advise the code below? thanks a lot!!

 

%let data = pd.model_EJM;
%let lr_avg = 0.033825737;
%let difference = 0.000001;
%let gap = -0.07;

%macro lr;
%do %until (&PD_diff <= &difference);
   data base;
   set &data;
   alpha = -6.0736;
   beta = 7.1518*beh_pred_pd + 26.2966*fin_pred_pd + 47.0150*qual_pred_pd;
   PD = exp(sum(&gap,alpha,beta)) / sum(1,exp(sum(&gap,alpha,beta)));
   adj_factor = &gap;
   run;

   proc sql;
   create table abc
   as select mean(PD) as avg_PD
   from base;
   quit;

   data abc;
   set abc;
   PD_diff = sum (avg_PD, -1 *&lr_avg);
   run;

   proc sql noprint;
   select round(PD_diff, 0.000001) into: PD_diff
   from abc;
   quit;

   %if &PD_diff > 0 %then %do;
      proc sql noprint;
      select sum(max(adj_factor), - 0.0001) into: gap
      from base;
      quit;
   %end;
   %else %if &PD_diff < 0 %then %do;
      proc sql noprint;
      select sum(max(adj_factor), 0.0001) into: gap
      from base;
      quit;
   %end;
%end;
%mend;
%lr;

The log shows that the PD_diff is not a numerical value therefore cannot run the code....

is there anyway I can fix the code...

thanks a lot!!!

Grand Advisor
Posts: 17,333

Re: Probability of default long run adjustment

Try using %evalf for the comparison since you have floating point numbers. 

Ask a Question
Discussion stats
  • 1 reply
  • 92 views
  • 0 likes
  • 2 in conversation