Quartz | Level 8

## Calculating P-trend for quartiles

Dear Friends,

I hope you are well. I am back. I need help calculating the P_trend for quartiles. I have read other posts on quartile, but I did not find help.

I have calculated quartiles,

``````Data PAPER2MASTER_OCT2018 ;set PAPER2MASTER_OCT2018 ;/*exclude missing data*/
If High_stafta_2005 <=-0.619  then HsatfatQuart_2005=1;/*exclude missing data*/
If High_stafta_2005 >-0.619001 and High_stafta_2005 <=0.077 then HsatfatQuart_2005=2;/*exclude missing data*/
If High_stafta_2005 > 0.077001 and High_stafta_2005 <=0.604  then HsatfatQuart_2005=3;/*exclude missing data*/
If High_stafta_2005 >0.604001 then HsatfatQuart_2005=4;/*exclude missing data*/
run; ``````

I want to find out the characteristics of participants with a high saturated fat intake.  So I want to find out the means of their age, anthropometric measurements and some biochemical parameters as well as dietary intake.

``````proc means data=PAPER2MASTER_OCT2018 median q1 q3 maxdec=3 nolabels;
class    HsatfatQuart_2005;*as to say by performs descriptions by a given variable;
var Age2015 WeightChange BMIchange WaistChange WHtRatioChange
Glucose2015 SBPOmr2015	DBP2015 	TC2015	HDLC32015	LDLC2015	TRIG2015 Glucose2015
E_TRANS_2005 E_addsug_2005 E_alcohol_2005 E_chotot_M_2005 E_mfat_2005 E_pfat_2005 E_sfat_2005
E_tfat_2005 E_tprot_2005 FFQALCOHOL_2005 FFQCHO_TOT_2005 FFQFAT_TOT_2005 FFQKJOUL_2005;
run;quit;

``````

I also calculated the significane levels using proc npar1way procedure.

However, I have a whole table and everything is significant.

So my questions is, is there a way to just calculate the general trend of the quartile and variables of persons under this quartile. Can I just get a P.value, that describes what's happening in the variables of persons in this quartile group, in this case, persons with high Sat fat intake. The general trend of the quartile.

Thank you for reading my post.

SAS amateur

Achieng

5 REPLIES 5
SAS Super FREQ

## Re: Calculating P-trend for quartiles

A couple of thoughts/ideas to share:

2. In general, statisticians discourage binning the data and then looking at trends across the groups. Many experts suggest using the underlying (raw) data instead of binning.

3. If you choose to ignore the advice in (2), you can get the trend by removing the CLASS statement and treating HsatfatQuart_2005 as a continuous variable with values 1,2,3,4.

4. You can get the analysis of only the high saturated fat group by using a where clause to select only that subset of the data:

WHERE HsatfatQuart_2005=4;

Quartz | Level 8

## Re: Calculating P-trend for quartiles

Dear Rick,

I really appreciate your comment and I will share it with my supervisors.

They actually want to explain why the high saturated fatty acid pattern (PCA analysis) is positively associated with obesity. I think they will take your advice, however, I still must present the results as well.

You know if you leave me to figure out the code, it will take me 1 week. So please just help me.

I have looked at the proc rank page you referred to, but not sure how to use the WHERE statement. I have been at it for the last few hours.

``````proc rank data=Sashelp.class out=class groups=&NumGroups ties=high;
var Height;   /* variable on which to group */
ranks Group;  /* name of variable to contain groups 0,1,...,k-1 */
run;``````

Very kind regards

Achieng

SAS amateur

SAS Super FREQ

## Re: Calculating P-trend for quartiles

Thanks for your confidence in me, but I can't write your code for you. Even if it takes you a week, it will be a learning experience. The more you struggle, read, and program, the better you will get. Each subsequent SAS project will take less time and one day you will be an expert who can answer other people's questions!

Regarding the WHERE clause and PROC RANK, sorry I wasn't clear. You should use PROC RANK first to get the groups. Then you can use WHERE clause to restrict your attention to the subjects in the largest ranked group. (Perhaps I am misundestanding what you want?)

For example, to analyze the tallest quartile of students, you can do the following:

``````proc rank data=Sashelp.class out=class groups=4 ties=high;
var Height;   /* variable on which to group */
ranks Group;  /* name of variable to contain groups 0,1,...,k-1 */
run;

proc means data=class;
where Group=3;   /* restrict to highest group */
var Height Weight Age;
run;``````
Quartz | Level 8

## Re: Calculating P-trend for quartiles

Dear Rick, thank you very much for your advice. I was able to read more on data binning and therefore we did not use the Ptrend.

Thank you.

I  am now calculating the number of people who were retained on a particular pattern after 10-years of follow up. Still on quartiles. If I get stuck, I will come to you.

Thank you all for helping me with my PhD, really appreciate.

Kindy kidn regards

Achieng

Fluorite | Level 6

## Re: Calculating P-trend for quartiles

Hello Rick,

I have a follow-up question. Is there a way to find the p-value for trend when doing a multivariate logistic regression? This guide explains that the Score test is equivalent to the Cochran-Armitage trend test. Essentially, they show how to obtain the p-value for trend in a logistic regression, using only one predictor variable. If I add covariates like age, etc. to the model, how can I find the p-value for trend for my main predictor in this case? I'm using logistic regression because I also want to find the Odds Ratio - to show the trend in the odds ratios for my study. (There's no literature online explaining how to do this, so I'm posting here).

Thank you.

Discussion stats
• 5 replies
• 3408 views
• 4 likes
• 3 in conversation