BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
wajmsu
Obsidian | Level 7

Hi,

I am trying to apply exact conditional logistic regression to my samll sample matched data with th efollowing code but t does not give me odds ratio. It gives coefficients with their CI.

Can yo ucorrect my code? Thanks

 

proc logistic data=pe.matchedata_21 desc;
strata group;
class CMV_ca_2_1 (ref='Absent');
format CMV_ca_2_1 CMV_igg.;
model PEstatus (event='1')= CMV_ca_2_1;
exact CMV_ca_2_1 / estimate = both;
run;

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

I don't know the answer to that, someone else will have to chime in now. 
Cheers!

View solution in original post

24 REPLIES 24
Reeza
Super User

Use an explicit ODDSRATIO statement or use the EXPB option in the model statement.

 

proc logistic data=pe.matchedata_21 desc;
strata group;
class CMV_ca_2_1 (ref='Absent');
format CMV_ca_2_1 CMV_igg.;
model PEstatus (event='1')= CMV_ca_2_1/ expb clodds=both;
exact CMV_ca_2_1 / estimate = both;
oddsratio cm_ca_2_1;
run;
wajmsu
Obsidian | Level 7

Thanks Reeza. However, it does not work. With 'oddsratio cmv_ca_2_1' no change.

With 'expb clodds=both' it even does not work; log states '
ERROR: The CLODDS=PL option is not allowed when a STRATA statement is specified.

 

Reeza
Super User

Change clodds to Wald or remove it. 

 

Please post 

1) log from code

2) parameter estimate table

wajmsu
Obsidian | Level 7

proc logistic data=pe.matchedata_21 desc;
strata group;
class CMV_ca_2_1 (ref='Absent');
format CMV_ca_2_1 CMV_igg.;
model PEstatus (event='1')= CMV_ca_2_1;
exact CMV_ca_2_1 / estimate = both;
oddsratio cmv_ca_2_1;
run;

Below is the table which I get for Exact analysis after using the above code. PLease note that before this table or exact analysis, the result contains non-exact output with 95%CI (output 1 below).

SAS Output 1

Odds Ratio Estimates and Wald Confidence Intervals Odds Ratio Estimate 95% Confidence Limits CMV_ca_2_1 Present vs Absent
2.3860.37415.232

SAS Output 2

Exact Parameter Estimates Parameter   Estimate Standard
Error 95% Confidence Limits Two-sided p-Value CMV_ca_2_1 Present
0.43480.4729-0.68861.7146

0.6250

 

Reeza
Super User

 

LOG?

 

 

wajmsu
Obsidian | Level 7

My apologies!

 


81   proc logistic data=pe.matchedata_21 desc;
NOTE: Data file PE.MATCHEDATA_21.DATA is in a format that is native to another host, or
      the file encoding does not match the session encoding. Cross Environment Data
      Access will be used, which might require additional CPU resources and might reduce
      performance.
82   strata group;
83   class CMV_ca_2_1 (ref='Absent');
84   format CMV_ca_2_1 CMV_igg.;
85   model PEstatus (event='1')= CMV_ca_2_1;
86   exact CMV_ca_2_1 / estimate = both;
87   oddsratio cmv_ca_2_1;
88   run;

NOTE: Writing HTML Body file: sashtml1.htm
NOTE: PROC LOGISTIC is modeling the probability that PEstatus='1'.
NOTE: Convergence criterion (GCONV=1E-8) satisfied.
WARNING: Odds ratios for CMV_ca_2_1 in the EXACT statement are not computed unless the
         reference parameterization is used.
NOTE: There were 73 observations read from the data set PE.MATCHEDATA_21.
NOTE: PROCEDURE LOGISTIC used (Total process time):
      real time           2.08 seconds
      cpu time            1.37 seconds

Reeza
Super User

PLEASE read the log in the future and post it in your question if you have issues.

It tells you exactly what you need to do to solve your issue. 

 


@wajmsu wrote:


WARNING: Odds ratios for CMV_ca_2_1 in the EXACT statement are not computed unless the
         reference parameterization is used.


 

 

Reeza
Super User

So I got some sample data and replicated your code. My log says this:

 

70 proc logistic data = exlogit desc;
71 class female;
72 freq num;
73 model admit = female apcalc;
74 exact female apcalc / estimate = both;
75 run;
 
NOTE: PROC LOGISTIC is modeling the probability that admit=1.
NOTE: Convergence criterion (GCONV=1E-8) satisfied.
WARNING: Odds ratios for female in the EXACT statement are not computed unless the reference parameterization is used.
NOTE: There were 8 observations read from the data set WORK.EXLOGIT.
NOTE: PROCEDURE LOGISTIC used (Total process time):
real time 0.28 seconds
cpu time 0.21 seconds
 
Once I changed the code to use reference parameterization, it worked. 
I would assume that your log has a similar warning? 
 
 
class CMV_ca_2_1 (ref='Absent')/param=ref;
wajmsu
Obsidian | Level 7

Thanks Reeza; it worked this time.

Both tables are below, exact and non-exact analysis.

My question is that why we use exact when we get wide 95%CI, usually we prefer narrow CI.

Exact Odds Ratios

Parameter

 

Estimate

95% Confidence Limits

Two-sided p-Value

CMV_ca_2_1

Present

2.386

0.252

30.852

0.6250

      

 

Odds Ratio Estimates

Effect

Point Estimate

95% Wald
Confidence Limits

CMV_ca_2_1 Present vs Absent

2.386

0.374

15.232

Reeza
Super User

I don't know the answer to that, someone else will have to chime in now. 
Cheers!

wajmsu
Obsidian | Level 7

Hi again Reeza,

As I start buidling multivariable model it again creates problem. Here are my codes and logs, once again thanks for your help.

 

proc logistic data=pe.matchedata_21 desc;
strata group;
class CMV_ca_2_1 (ref='Absent')/param=ref bmicat (ref='Less than 25')/param=ref;
format CMV_ca_2_1 CMV_igg. bmicat bmicat.;
model PEstatus (event='1')= CMV_ca_2_1 bmicat;
exact CMV_ca_2_1 bmicat / estimate = both;
oddsratio cmv_ca_2_1 bmicat;
run;

153  proc logistic data=pe.matchedata_21 desc;
NOTE: Data file PE.MATCHEDATA_21.DATA is in a format that is native to another host, or
      the file encoding does not match the session encoding. Cross Environment Data
      Access will be used, which might require additional CPU resources and might reduce
      performance.
NOTE: PROCEDURE LOGISTIC used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds

NOTE: The SAS System stopped processing this step because of errors.
154  strata group;
155  class CMV_ca_2_1 (ref='Absent')/param=ref bmicat (ref='Less than 25')/param=ref;
                                               ------
                                               22
                                               76
ERROR 22-322: Syntax error, expecting one of the following: ;, CODING, CPREFIX, DESC,
              DESCENDING, LPREFIX, MISSING, ORDER, PARAM, REF, REFERENCE, TRUNCATE.
ERROR 76-322: Syntax error, statement will be ignored.
156  format CMV_ca_2_1 CMV_igg. bmicat bmicat.;
157  model PEstatus (event='1')= CMV_ca_2_1 bmicat;
158  exact CMV_ca_2_1 bmicat / estimate = both;
159  oddsratio cmv_ca_2_1 bmicat;
160  run;

Reeza
Super User

Param=ref is only specified only once at the end of your class statement. 

 

If you really want multiple methods you can use multiple class statements. 

 

In this case the error isn't very helpful 😉

wajmsu
Obsidian | Level 7
 
wajmsu
Obsidian | Level 7

It did not change putting Param=ref once.

 

Problem remians the same.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is ANOVA?

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.

Discussion stats
  • 24 replies
  • 2867 views
  • 2 likes
  • 3 in conversation