Hello,

I have been using Stata to analyse all of my data, however my supervisor has asked me to perform a trend test similar to SPSS' "linear-by-linear association" in crosstab>chi2.

I have two different things to test trends for:
1. test trend of a continuous variable (example age) across an ordered variable (quantiles in my case, score 1 2 3 4).
2. test trend for categorical variable (example type of diet - not ordered) across an ordered variable (again, same quantiles).

How do I perform these tests in Stata?
I have been using nptrend for 1. and thought it was correct but it doesn't give me the same output as in SPSS.
I have read the Stata article about trends, also tried the vwls command (again similar but not the same output as SPSS).

Is it okay to use nptrend in case 2. ?

Thank you for your help and time,
Céline (a beginner epidemiologist)