BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
KMack
Calcite | Level 5

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.

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

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

PG

View solution in original post

6 REPLIES 6
PGStats
Opal | Level 21

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

PG
KMack
Calcite | Level 5

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. 

PGStats
Opal | Level 21

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

PG
KMack
Calcite | Level 5

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?

PGStats
Opal | Level 21

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

PG
KMack
Calcite | Level 5

So, I tried the codes today on a diferent data set and they worked!  Thanks for the help.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 2607 views
  • 0 likes
  • 2 in conversation