BookmarkSubscribeRSS Feed
Manije72
Calcite | Level 5

Hi

I want to explore the relationship between fruit consumption and diabetes. I've categorized fruit intake into tertiles, while diabetes status is binary (yes/no). I want to adjust the findings to age (continuous), gender (categorical), race (categorical), and physical activity (categorical) in the analysis. Is the logistic regression code that I want to use correct?

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

class Gender(ref='1') race(ref='1') physical_activity(ref='1')/param=ref ;

model diabetes(event='1')= fruitcode age Gender race physical_activity/Clodds=wald;

title " Association of fruit with diabetes (adjust for age, gender, race, physical activity) ";

run;

Fruitcode: I used fruit tertile in this code.

 

For finding the P-trend, I used this code:

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

model diab(event='1')= fruit age Gender race physical_activity/Clodds=wald;;

run;

Fruit is continuous

3 REPLIES 3
PaigeMiller
Diamond | Level 26

You asked the exact same question in 2023 and it was answered.

https://communities.sas.com/t5/Statistical-Procedures/The-code-for-P-trend-for-logistic-regression/t...

--
Paige Miller
StatDave
SAS Super FREQ

If you have a continuous measure of fruit consumption, then reducing it to a 3 level variable just throws away information. So I would use your FRUIT variable as a predictor, not FRUITCODE. Then, I would use your first PROC LOGISTIC step, particularly if either GENDER or RACE has more than two levels. You should put a variable in the CLASS statement any time it is a categorical variable and has more than two levels. Then the CLASS statement will internally create a set of dummy-coded variables to represent it in the model. As I mentioned in your previous question, the test of FRUIT will then test the linear trend of fruit consumption on the log odds of diabetes. If that's not what you mean by "P-trend" then you need to clarify exactly what you mean by it. But be aware that it is possible that consumption is not linearly associated with with diabetes, and if so, your model does not accommodate that because it assumes a linear association. There are ways, such as splines, to allow the model to be more flexible if you have a reason to suspect nonlinearity.

Manije72
Calcite | Level 5

Thank you for your response.

Can you help me where I can find P-value trend for logistic regression in SAS results? For example, in this table https://www.nature.com/articles/s41598-024-52946-z/tables/4, how is the P-value trend calculated?

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 3 replies
  • 255 views
  • 1 like
  • 3 in conversation