Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Analytics
- /
- Stat Procs
- /
- P for trend in Proc surveylogisitic

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 01-16-2020 12:24 AM
(1024 views)

Hello again. I want to run a logistic regression. My dependent variable is Mets and independent variable is Q (Quartiles of Dietary Inflammatory Index) (coded as 1,2,3,4) My covariates are age, Energy intake,BMI, education (coded 0, 1, 2), Alcohol(0,1), exercise (0,1),smoking(o,1) and physical exercise (0,1).

```
proc surveylogistic data = Project1.DII_M;
weight pooled_wt;
cluster psu;
strata kstrata;
class Q (reference = '1') educn(reference='2') smoking (reference='0') exercise (reference='1') Drinking (reference='0');
model Mets (desc) = age HE_BMI educn Drinking smoking exercise N_EN Q;
Domain sex;
run;
```

I then want to calculate p for trend. To do this, I assigned the median value (Q_median) of the variable Adj_DII in each quartile category to each participant and modeled this as a continuous variable and read off the pr>t as my p for trend.

I used the following code to determine median values, assigning them to participants and running a logistic regression.

```
/*obtaining median in each quartile*/
proc report data=Project1.DII_Q out=dii_median;
columns sex Q Adj_DII;
define sex / group "Sexe";
define Q / group "Quartile";
define Adj_DII / median;
run;
/*Assigning median value to individuals*/
data Project1.DII_M;
set Project1.DII_Q;
if sex=1 and Q=1 then Q_median=-1.10;
else if sex=1 and Q=2 then Q_median=0.13;
else if sex=1 and Q=3 then Q_median=1.13;
else if sex=1 and Q=4 then Q_median=2.27;
else if sex=2 and Q=1 then Q_median=-1.22;
else if sex=2 and Q=2 then Q_median=0.10;
else if sex=2 and Q=3 then Q_median=1.06;
else if sex=2 and Q=4 then Q_median=2.06;
if HE_BMI LE 18.5 then BMI_cat=0;
else if 18.5 LT HE_BMI LT 23 then BMI_cat=1;
else if 23 LT HE_BMI LT 25 then BMI_cat=2;
else if HE_BMI GE 25 then BMI_cat=3;
Keep Age sex pooled_wt kstrata psu HE_BMI educn Drinking smoking exercise N_EN Q
Mets Hy_glu Abd_obs TG_high Low_HDL HTN Q_median Adj_DII BMI_cat ;
run;
/*obtaining p for trend..(method adopted from some paper*/
proc surveylogistic data = Project1.DII_M;
weight pooled_wt;
cluster psu;
strata kstrata;
model Mets(desc) = age HE_BMI educn Drinking smoking exercise N_EN Q_median;
Domain sex;
run;
```

The p for trend obtained in this paper was 0.008 whereas mine is 0.09 so far from this value. I would like to know where I went wrong. I have attached my working data set.

1 REPLY 1

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

@Prest wrote:Hello again. I want to run a logistic regression. My dependent variable is Mets and independent variable is Q (Quartiles of Dietary Inflammatory Index) (coded as 1,2,3,4) My covariates are age, Energy intake,BMI, education (coded 0, 1, 2), Alcohol(0,1), exercise (0,1),smoking(o,1) and physical exercise (0,1).

`proc surveylogistic data = Project1.DII_M; weight pooled_wt; cluster psu; strata kstrata; class Q (reference = '1') educn(reference='2') smoking (reference='0') exercise (reference='1') Drinking (reference='0'); model Mets (desc) = age HE_BMI educn Drinking smoking exercise N_EN Q; Domain sex; run;`

I then want to calculate p for trend. To do this, I assigned the median value (Q_median) of the variable Adj_DII in each quartile category to each participant and modeled this as a continuous variable and read off the pr>t as my p for trend.

I used the following code to determine median values, assigning them to participants and running a logistic regression.

`/*obtaining median in each quartile*/ proc report data=Project1.DII_Q out=dii_median; columns sex Q Adj_DII; define sex / group "Sexe"; define Q / group "Quartile"; define Adj_DII / median; run; /*Assigning median value to individuals*/ data Project1.DII_M; set Project1.DII_Q; if sex=1 and Q=1 then Q_median=-1.10; else if sex=1 and Q=2 then Q_median=0.13; else if sex=1 and Q=3 then Q_median=1.13; else if sex=1 and Q=4 then Q_median=2.27; else if sex=2 and Q=1 then Q_median=-1.22; else if sex=2 and Q=2 then Q_median=0.10; else if sex=2 and Q=3 then Q_median=1.06; else if sex=2 and Q=4 then Q_median=2.06; if HE_BMI LE 18.5 then BMI_cat=0; else if 18.5 LT HE_BMI LT 23 then BMI_cat=1; else if 23 LT HE_BMI LT 25 then BMI_cat=2; else if HE_BMI GE 25 then BMI_cat=3; Keep Age sex pooled_wt kstrata psu HE_BMI educn Drinking smoking exercise N_EN Q Mets Hy_glu Abd_obs TG_high Low_HDL HTN Q_median Adj_DII BMI_cat ; run; /*obtaining p for trend..(method adopted from some paper*/ proc surveylogistic data = Project1.DII_M; weight pooled_wt; cluster psu; strata kstrata; model Mets(desc) = age HE_BMI educn Drinking smoking exercise N_EN Q_median; Domain sex; run;`

The p for trend obtained in this paper was 0.008 whereas mine is 0.09 so far from this value. I would like to know where I went wrong. I have attached my working data set.

Without seeing the paper, could be for any number of reasons. How do you expect anyone to know how your work difers from a paper when you don't provide the paper?

**Don't miss out on SAS Innovate - Register now for the FREE Livestream!**

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

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.