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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.