Calculating Odds Ratios from Logistic Regression Results

One can obtain odds ratios from the results of logistic regression model.  Odds ratios derived are adjusted for predictors included in the model and explains the relationship between two groups (e.g., treatment and control group) and outcome (binary outcome).  I wrote the following Excel document that calculates odds ratio based on logit coefficients from the intercept and the predictor of interest (binary ones: e.g., impact coefficient, gender effect, etc.).

https://drive.google.com/file/d/0B7AoA5fyqX_sN0RUc0E5aFowb00/view?usp=sharing

Appendix (p.27) of the following document includes description of odds ratio.

http://www.doe.k12.de.us/cms/lib09/DE01922744/Centricity/Domain/91/MA1275TAFINAL508.pdf

Using PROC LOGISTIC to Estimate the Rasch Model by Pan and Chen

http://support.sas.com/resources/papers/proceedings11/342-2011.pdf

Can this be right?  If right, it helps reduce the computational demand off the procedure.   Page 4:

"When thousands of persons take a test, the procedure takes a long time to estimate the parameters. It is well known that the Rasch model gives the same parameter estimates for each person who receives the same total score. So, variable ‘person’ is able to be replaced with variable ‘total’ when all examinees answer all items as shown by Nord (2008). After the model is fit, the estimate of the parameter for each person is equal to the estimate of the parameter of the total score corresponding to the person’s total score. The third code example and its output are shown as follows:"

Dummy variables in logistic regression models

Why do switching of values in a dummy variable and the use of class statement in PROC LOGISTIC change the coefficients in logistic regression?

(1) and (2) produce the same results. (3) and (4) produce the same results.

(1)
proc logistic data=here.asdf descending ;
model college= boy ;
run;

(2)
proc logistic data=here.asdf descending ;
class girl;
model college= girl ;
run;

(3)
proc logistic data=here.asdf descending ;
model college= girl;
run;

(4)
proc logistic data=here.asdf descending ;
class boy;
model college= boy ;
run;

(1) Estimates (2) Estimates (3) Estimates (4) Estimates
Intercept

0.5346

 Intercept

0.3645

 Intercept

0.1945

 Intercept

0.3645

boy      

-0.3401

 girl    

-0.1701

 girl

0.3401

 boy      

0.1701

               
Odds ratio

0.712

 

0.712

 

1.405

 

1.405

ROC Curve Analysis using PROC LOGISTIC

/*ROC Curve Analysis Macro*/

/*a hypothetical data set*/
data asdf;set sashelp.class;
EVENT=0;
if Weight > 100 then EVENT=1;
PREDICTOR=height;
run;

/*data name*/
%let dataname=asdf;
%let outcome=EVENT;
%let ind=PREDICTOR;
%let save_graphic=C:\Documents and Settings\19702\My Documents\sas;

ods html PATH="&save_graphic" (url=none) file="&dataname &ind .html";
ods graphics on / imagename="&dataname&ind";
proc logistic data=&dataname descending OUTEST=&dataname.result;
title "&dataname";
model &outcome =
&ind
/ outroc=&dataname.kaz2 ROCEPS=0 ;
output out = m2 p = prob xbeta = logit ;
ods output ParameterEstimates=kazcoeff
Association=kazassoc
ConvergenceStatus=kazconverg(keep= reason);
run;
ods graphics off;
ods html close;

proc transpose data=kazassoc out=T1;
var cValue1;
id label1;
run;
proc transpose data=kazassoc out=T2;
var cValue2;
id label2;
run;

data kazassoc2;
merge T1 T2;
run;

/*ods trace off;*/
/*Get descriptive statistics*/

ods listing close;
proc means data=&dataname;
var
&outcome
&ind
;
ods output summary=uekawa;
run;
ods listing;
/*get significance of the independent varible*/
data kazcoeff2;
set kazcoeff;
if Variable="&ind";
keep ProbChiSq StdErr flag;
flag=1;
label ProbChiSq="P-value for the ind var effect";
label StdErr="Stderr for the ind var effect";
run;

data &dataname.kaz2;set &dataname.kaz2;
flag=1;
run;

data &dataname.result;
set &dataname.result;
flag=1;
run;

data &dataname.kaz3;merge &dataname.kaz2 &dataname.result kazcoeff2;
by flag;
run;

data &dataname.kaz4;set &dataname.kaz3;
Distance=sqrt( (0-_1MSPEC_)**2 + (1-_SENSIT_)**2 );
suji=_n_;
run;
proc sql;
create table &dataname.kaz5 as
select *,
min(distance) as minimum_distance
from &dataname.kaz4;
run;

data optimal;
retain CUT_OFF_VALUE;
set &dataname.kaz5;
CUTOFF=0;
if distance = minimum_distance then do; CUTOFF=1; type="Dist to perfection";end;
/*if distance2 = maximum_distance2 then do; CUTOFF=1;
type="Dist to noninf";end;*/
if cutoff=1;
effect=&ind ;
LOGIT=LOG(_PROB_ / (1-_PROB_));
CUT_OFF_VALUE=((LOGIT-Intercept)/effect);
drop cutoff ;
run;
data results_of_ROC;
merge optimal uekawa kazassoc2 kazconverg;

TRUE_POSITIVE_RATE=_SENSIT_;
TRUE_NEGATIVE_RATE=1-_1MSPEC_;
AUC=C;
run;

proc print data=results_of_ROC;
title "ROC stats for &outcome";
var CUT_OFF_VALUE
TRUE_POSITIVE_RATE
TRUE_NEGATIVE_RATE
AUC ;
run;