If you want to do this as part of an analysis of observed data and obtain estimates of the odds ratio at various values of X (since the odds ratio changes with X) along with tests that the odds ratio equals 1 and confidence intervals, you can use the NLEST macro. That macro is needed since, as has been shown, the odds ratio on X is a nonlinear function of the model parameters. Following is an example with random data from known model logit(p)=a+bX with a and b values as specified. The model on log(x) is estimated and saved with PROC LOGISTIC and then the NLEST macro is used to evaluate the model at log(x+1) and log(x), for various x, and exponentiating their difference. As noted, the evaluating expressions in the FDATA= data set could be simplified to [(x+1)/x]**b. Change the "+1" in the expressions to another value if you want to evaluate an increase of other than 1 unit. Alternatively, you could use the macro to estimate the increase in risk (event probability) using data lines like at x=1 , logistic(b_p1+log(1+1)*b_p2) - logistic(b_p1+log(1)*b_p2) or even to evaluate the risk ratio for increasing X with data lines like at x=1 , logistic(b_p1+log(1+1)*b_p2) / logistic(b_p1+log(1)*b_p2)
data a;
n=10000; a=-2.5; b=2;
do lnx=0 to 1 by .1;
x=exp(lnx);
logit=a+b*lnx;
truodds=exp(logit);
truodxp1=exp(a+b*log(x+1));
truor=truodxp1/truodds;
p=logistic(logit);
y=rand("binomial",p,n);
output;
end;
run;
proc logistic data=a;
model y/n = lnx;
effectplot / link;
store log;
run;
data fd;
length label f $32767;
infile datalines delimiter=',';
input label f;
datalines;
at x=1 , exp( (b_p1+log(1+1)*b_p2) - (b_p1+log(1)*b_p2) )
at x=1.5 , exp( (b_p1+log(1.5+1)*b_p2) - (b_p1+log(1.5)*b_p2) )
at x=2 , exp( (b_p1+log(2+1)*b_p2) - (b_p1+log(2)*b_p2) )
at x=2.5 , exp( (b_p1+log(2.5+1)*b_p2) - (b_p1+log(2.5)*b_p2) )
;
%nlest(instore=log, fdata=fd, null=1, title=ORs at various X values)
... View more