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 = ⪆
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!!!
Try using %evalf for the comparison since you have floating point numbers.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.