Hello,
I would like to run a Proc Logistic Model for the attached sample dataset, a case-control study.
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;
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).
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
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.
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;
What about the STRATA variable RS? Do you have three levels of NEW_CMI_ONE for each value of RS?
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
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?
Thanks,
Here is a sample:
Logistic Regression Estimates by CMI Category |
|
|
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;
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
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.