Fluorite | Level 6

## How to write a code for multivariate conditional logistic regression for numeric variables

Hello,

I need some help. I am conduting a retrospective study on whether different classes of diabetes meds affect cholesterol. I want to generate a conditional logistic regression to generate the following Adjusted odds ratios:

Odds ratio for Diabetic medication use (y/n) and type of DM med and cholesterol level (high /low)

So I currently have the data set up as following variables (I made them all numeric)

Dependant variable: 0 = Normal Cholestrol  1= Borderline Cholesterol  2= High Cholesterol

and the Independent variables are : DM med (1/0), different variables columns for each Med e.g. metform (1/0), glyburide (1/0), where 1 is yes and 0 = No. I also have additional independent variables that we need to adjust for like age, GENDER, sepsis .. all are numeric coded as 1/0 and BMI also which is coded as 1/2/3 depedening on how high the BMI is..

Can someone help me write a code for what I want? I am completely lost...

thanks

7 REPLIES 7
Diamond | Level 26

## Re: How to write a code for multivariate conditional logistic regression for numeric variables

There is an example that says "Logistic Modeling with Categorical Predictors", seems like exactly what you want.

Age is coded as 0/1?

--
Paige Miller
Fluorite | Level 6

## Re: How to write a code for multivariate conditional logistic regression for numeric variables

Will that help?

All my variables are numeric and not categorical..

I also coded BMI as 1,2,3,4,5 where each number stands for a specific BMI , age is also coded as 0,1,2 where each number is a specific age group.. hence I am asking for numeric variables

thanks

SAS Super FREQ

## Re: How to write a code for multivariate conditional logistic regression for numeric variables

Hello,

@manthan wrote:

I also coded BMI as 1,2,3,4,5 where each number stands for a specific BMI , age is also coded as 0,1,2 where each number is a specific age group.. hence I am asking for numeric variables

That's NOT a good idea if your BMI-classes and | or age classes are not evenly spaced. Moreover 1,2,3,4,5 and 0,1,2 are not exactly interval-scaled (continuous). The range is very limited.
You really need to use categorical predictors.

Koen

Diamond | Level 26

## Re: How to write a code for multivariate conditional logistic regression for numeric variables

@manthan wrote:

Will that help?

All my variables are numeric and not categorical..

It doesn't matter if they are numeric. You put those variable names in the CLASS statement, and they will be treated as categorical.

--
Paige Miller
SAS Super FREQ

## Re: How to write a code for multivariate conditional logistic regression for numeric variables

Hello,

Conditional logistic regression is an extension of logistic regression that allows one to take into account stratification and matching.
Do you have something like "Matched Pairs", for example?
If not, it's a mere classic Logistic Regression with a nominal (use Generalized Logits) or ordinal outcome variable (use Cumulative Logit a.o.).

The internet is full of SAS code examples for (conditional) logistic regression.
Tip : visit https://www.lexjansen.com/

and ... enter the search terms you want and then ... search.

Moreover, you want to fit a MULTIPLE logistic regression. MULTIVARIATE makes me think you have several response variables you want to simultaneously model. And the latter is not what you want to do. It's the former (multiple predictors | explanatory inputs).

Good luck,

Koen

Barite | Level 11

## Re: How to write a code for multivariate conditional logistic regression for numeric variables

ods graphics on;

proc logistic data = have plots(only)=(effect oddsratio);

class cholesterol(ref = '0') metformin(ref = '0') glyburide(ref = '0') gender(ref = 'Female') sepsis(ref='0');

*categorical variables and ternary outcome (cholesterol) go into the class statement above;

model cholesterol = age gender metformin gliburide sepsis bmi / clodds=pl orpvalue link=glogit;

*bmi per your definition is a categorical ordinal variable, listed above as pseudo-continuous (vs. age is a true continuous variable);

run;

SAS Super FREQ

## Re: How to write a code for multivariate conditional logistic regression for numeric variables

While it is not something I've researched, I believe that if your goal is to estimate the odds ratios for the variables in the model then you can fit an ordinary logistic model in PROC LOGISTIC and use the reported odds ratios without taking any steps to account for the retrospective sampling. This is the case for the retrospective analysis of binary response data as discussed in this note on oversampling. But as noted there, it is likely that the intercepts in the model will be affected by the sampling and thus the computation of predicted probabilities would not proceed as usual. I would encourage you to look further into this issue to verify the validity of this approach.

To complete the discussion of the word "multivariate"... the proper word for a multi-level, categorical variable is multinomial, which is the name of the distribution it follows. A multinomial variable can be either ordinal or nominal. Your description of the response suggests it is ordinal, so my suggestion above would be to fit an ordinary ordinal, multinomial logistic model - also known as a proportional odds model. This is done with exactly the same syntax as if the response were binary, but be sure in the Response Profile table in the results that your response levels are in logical increasing or decreasing order. See this note for a description and fitting methods for many types of logistic models.

Discussion stats
• 7 replies
• 800 views
• 7 likes
• 5 in conversation