Hi guys,
My task is very simple. I'm using PROC LOGISTIC with the argument ctable and pprob.
If I use pprob=0.5 (a number) my procedure runs. However, whenever I try an expression (say 10/100 or, more interestingly, a variable's name inside an expression like i/100) SAS returns the following error:
%macro logistic_macro;
%do i = 1 %to 100;
proc logistic data=WORK.GLMDesign outmodel=final_model noprint;
class Col3 Col4 Col7 Col8 Col9 Col13 Col22 Col23 Col27 Col28 / param=glm;
model VAR21(event='1')= Col3 Col4 Col7 Col8 Col9 Col13 Col22 Col23 Col27 Col28
Col2 / link=logit technique=fisher ctable pprob=%EVAL(&i./100) ;
output out=preds predprobs=individual;
score data=testset out=TestPred_new;
run;
proc freq data=TestPred_new;
table VAR21*I_VAR21 / out=CellCounts_new noprint;
run;
proc iml; /* using matrix language like in HW06 to make our lives easier */
loss= j(100, 1, 0); /*vector to store loss for different thresholds */
use work.CellCounts_new;
read all var _ALL_ into M;
close work.CellCounts_new;
FalsePos = M[2,2] # 5;
FalseNeg = M[3,2];
loss[i] = FalsePos + FalseNeg;
print loss;
%end;
%mend;
%logistic_macro; *runs the macro;
I appreciate your help as usual!That's strange. I just tried it with dummy data and it worked for me, meaning changing the option to
pprob=%SYSEVALF(&i./100)
%EVAL won't give you the decimal accuracy that you need. Try %SYSEVALF instead.
%let i=1;
%put %EVAL(&i./100);
%put %SYSEVALF(&i./100);
If you were to run the above, here are the results printed to the log:
0
0.01
That's strange. I just tried it with dummy data and it worked for me, meaning changing the option to
pprob=%SYSEVALF(&i./100)
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.