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

Hello,

 

I would like to run a Proc Logistic Model for the attached sample dataset, a case-control study.

  • CMI level (1, 2 or 3) 1 is  0-1 comorbidities   /  2 is  2-4 comorbidities and 3 is 5+ comorbidities that I summed up previously.  
  • All variables in the dataset are numerical (length 😎
  • Censor is the event (1 or 0).
  • RS is the risk set (1 case and 4 controls each)
  • halop_only is the exposure
  • olanz_only is another exposure that I will test separately.  

 

Basically, I want to test CMI at different levels and present it in a table as follows: 

Example: 

Comorbidity level
CMI:0–1      halop_only 1.24 (0.44–3.43)

CMI:2–4      halop_only 0.40 (0.04–3.75)

CMI:5 +       halop_only 1.60 (0.83–3.07)

 

Here is my code, is it correct?  I am getting a warning: "WARNING: More coefficients than levels specified for effect new_CMI_One. Some coefficients will
be ignored".

 

Your help will be appreciated!

Thanks,

proc logistic data=test;
class new_CMI_One;
model Censor(event='1') =  halop_only new_CMI_One / clparm=wald;
estimate 'CMI:0-1' new_CMI_One 1 -1 0 halop_only 0;
strata rs;
run;

  

1 ACCEPTED SOLUTION

Accepted Solutions
Schtroumpfette
Obsidian | Level 7
Thanks for the input! This is very helpful.
I am not getting the warning with the latest code I am using, but it is clearer now. Thanks for tagging them.

View solution in original post

11 REPLIES 11
PaigeMiller
Diamond | Level 26

You have fewer than 3 levels of NEW_CMI_ONE, but you give coefficients in the ESTIMATE statement for 3 levels.

 

Please, from now on show us the ENTIRE log for PROC LOGISTIC (or whatever PROC or DATA step has the error). Do not show us partial logs for PROC LOGISTIC (or whatever PROC or DATA step has the error).

--
Paige Miller
Schtroumpfette
Obsidian | Level 7

Thanks Paige, I am not getting an error but a warning.  I want to be sure the code is correct, please.

 

134
135 proc logistic data=test;
136 class new_CMI_One;
137 model Censor(event='1') = halop_only new_CMI_One / clparm=wald;
138 estimate 'CMI:0-1' new_CMI_One 1 -1 0 halop_only 0;
139 strata rs;
140 run;

NOTE: PROC LOGISTIC is modeling the probability that censor=1.
NOTE: Convergence criterion (GCONV=1E-8) satisfied.
WARNING: More coefficients than levels specified for effect new_CMI_One. Some coefficients will
be ignored.
NOTE: There were 150 observations read from the data set WORK.TEST.
NOTE: PROCEDURE LOGISTIC used (Total process time):
real time 0.65 seconds
cpu time 0.07 seconds

 

PaigeMiller
Diamond | Level 26

You are right, it's not an ERROR its a WARNING.

 

Your code seems fine as no ERROR messages appear. But you still ought to investigate the WARNING.

--
Paige Miller
Schtroumpfette
Obsidian | Level 7

Thanks Page,

I will have to investigate the warning, but I have 3 new_CMI_levels (and checked by proc freq), so not sure what the issue is. 

 

What would the code be if I want to run it for all three CMI levels.  Is this code correct?  

 

proc logistic data=test;
class new_CMI_One;
model Censor(event='1') =  halop_only new_CMI_One / clparm=wald;
estimate 'CMI:0-1' new_CMI_One 1 -1 0 halop_only 0;
estimate 'CMI:0-1 vs. 5+' new_CMI_One 1 0 -1 halop_only 0;
estimate 'CMI:2-4 vs. 5+' new_CMI_One 0 1 -1 halop_only 0;
strata rs;
run;
PaigeMiller
Diamond | Level 26

What about the STRATA variable RS? Do you have three levels of NEW_CMI_ONE for each value of RS?

--
Paige Miller
Schtroumpfette
Obsidian | Level 7

It varies, the value for new_one_cmi can be 1, 2 or 3 for each risk set.   new_cmi_one represents comorbidities so each patient in RS (1  case and 4 controls) can have different comorbidity levels.  I attached a sample in csv but would be happy to send it differently.  

new_cmi_one (1) is 0-1 comorbidities

new_cmi_one (2) 2-4 comorbidities

new_cmi_one (3) 5+ comorbidities

 

They are not always the same for each matched case and control.  They were matched on age and sex.

e.g. 

New_cmi_one      rs

1                           1

1                           1

2                           1

2                           1

3                           1

3                           1

 

PaigeMiller
Diamond | Level 26

I don't need to look at your data. That's a skill that you have, so I don't need to look at it for you. What happens when you run the PROC FREQ for RS*NEW_CMI_ONE?

--
Paige Miller
Schtroumpfette
Obsidian | Level 7

Thanks,

 

Here is a sample:

 

Logistic Regression Estimates by CMI Category

The FREQ Procedure
Frequency
Percent
Row Pct
Col Pct
Table of rs by new_CMI_One
rs new_CMI_One
1 2 3 Total
1
2
1.33
33.33
2.56
2
1.33
33.33
3.39
2
1.33
33.33
15.38
6
4.00
 
 
4
2
1.33
33.33
2.56
4
2.67
66.67
6.78
0
0.00
0.00
0.00
6
4.00
 
 
5
3
2.00
50.00
3.85
2
1.33
33.33
3.39
1
0.67
16.67
7.69
6
4.00
 
 
6
3
2.00
50.00
3.85
3
2.00
50.00
5.08
0
0.00
0.00
0.00
6
4.00
Schtroumpfette
Obsidian | Level 7

Hi Paige, I ran this code and it seems to have worked but would really like to have your thoughts!


ods output ParameterEstimates=estimates_0_1;
proc logistic data=malib.sk_collapseB;
  class new_CMI_One;
  model Censor(event='1') = halop_only new_CMI_One / clparm=wald;
  where new_CMI_One=1;
  estimate 'CMI:0-1' halop_only 0;
  strata rs;
run;

ods output ParameterEstimates=estimates_2_4;
proc logistic data=malib.sk_collapseB;
  class new_CMI_One;
  model Censor(event='1') = halop_only new_CMI_One / clparm=wald;
  where new_CMI_One=2;
  estimate 'CMI:2-4' halop_only 0;
  strata rs;
run;

ods output ParameterEstimates=estimates_5plus;
proc logistic data=malib.sk_collapseB;
  class new_CMI_One;
  model Censor(event='1') = halop_only new_CMI_One / clparm=wald;
  where new_CMI_One=3;
  estimate 'CMI:5+' halop_only 0;
  strata rs;
run;
ballardw
Super User

Which shows only two levels of New_cmi_one when Rs is 4 or 6. That is what the 0 indicates. So you have two strata that could trigger than message about too few levels.

 


@Schtroumpfette wrote:

Thanks,

 

Here is a sample:

 

Logistic Regression Estimates by CMI Category

The FREQ Procedure
Frequency
Percent
Row Pct
Col Pct
Table of rs by new_CMI_One
rs new_CMI_One
1 2 3 Total
1
2
1.33
33.33
2.56
2
1.33
33.33
3.39
2
1.33
33.33
15.38
6
4.00
 
 
4
2
1.33
33.33
2.56
4
2.67
66.67
6.78
0
0.00
0.00
0.00
6
4.00
 
 
5
3
2.00
50.00
3.85
2
1.33
33.33
3.39
1
0.67
16.67
7.69
6
4.00
 
 
6
3
2.00
50.00
3.85
3
2.00
50.00
5.08
0
0.00
0.00
0.00
6
4.00

 

 

Schtroumpfette
Obsidian | Level 7
Thanks for the input! This is very helpful.
I am not getting the warning with the latest code I am using, but it is clearer now. Thanks for tagging them.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 11 replies
  • 2046 views
  • 2 likes
  • 3 in conversation