Good day:
I'm wondering how I can test for a trend across outcome categories in multinomial logistic regression? I have four different durations of breastfeeding and several different predictor variables and I would like a p-value for trend for each predictor.
Here is my code:
surveylogistic data=final;
ebf (ref='5.5-6.5') hs_q01 (Ref='english OR FRENCH or other') supplement (ref='yes')prenat (Ref='lo') rigon (ref='two') ;
ebf=supplement/link=glogit;
weight weight_ch;
strata community;
run;
I've tried a test statement, but I can't seem to get the code to run. Any help is greatly appreciated.
Try a simplified program first:
proc surveylogistic data=final;
class hs_q01(ref='1');
model ebf(ref='1') = hs_q01 / glogit;
test intercept = intercept1;
run;
and see if that will work. We can then build from there.
PG
K, your code didn't copy too well (known problem...). I'm assuming proc, class and model statements. From the doc, seems like the test statement should read :
Hetero: test intercept = intercept1 = intercept2 = intercept3;
What message do you get?
PG
Yes. Proc, class, and model statements. Thanks for catching that cut and paste error, PG.
I was able to deduce that the appropriate code was what you provided: test intercept: intercept1=intercept2=intercept3 but I'm not sure how I can re-code my variables so that SAS recognizes that 'intercept1' is, say the intercept of hs_q01 for EBF duration 1 and intercept 2 is the intercept of hs_q01 EBF duration 2. I'm getting the error message that the variable is not in my model, which is what I expected. Is this because i've used class statements instead of dummy variables?
I was thinking of outputting my intercepts into another database and then re-running the code, but my SAS/statistics knowledge is a bit lacking.
K, I am not clear as to what you want exactly. Your model statement relates ebf to supplement only. Your other variables hs_q01, prenat and rigon are NOT in the model. Mentionning them in a CLASS statement merely informs SAS of their categorical nature and reference level. It does not include them in your model. In the test statement I proposed (that's an equal sign after intercept) there is one intercept for each level of your outcome variable. Try it also without intercept4, I'm not sure its needed.
Good luck.
PG
Thanks PG. That was careless - of course hs_q01 isn't in the model I pasted. Are you saying my code should look like this?
proc surveylogistic;
class ebf (ref='1') hs_q01 (ref='1');
model ebf=hs_q01/glogit;
weight weight_ch;
strata community;
test intercept1=intercept2 OR
test hs_q011=hs_q012?
run;
This isn't running. I don't have an 'intercept1, 2 etc' or a hs_q011 in my model that I've defined. Right?
Try a simplified program first:
proc surveylogistic data=final;
class hs_q01(ref='1');
model ebf(ref='1') = hs_q01 / glogit;
test intercept = intercept1;
run;
and see if that will work. We can then build from there.
PG
So, I tried the codes today on a diferent data set and they worked! Thanks for the help.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.