BookmarkSubscribeRSS Feed
stats
Calcite | Level 5

I have data with response variable(survived = yes or no) and independent variable (class= first class, second class, third class) and I want to do multiple comparison to test whether b co-efficient of class 1 = class 2 using SAS.

I was trying proc glm along with contrast statement. Can anyone please help how to structure this code to test at alpha level 0.01.

So far, I have used

proc glm data=titanic;

class class;

model survived=class;

contrast 'hypotheis' , class 1 vs class 2 alpha=0.01;

run;

Thanks in advance!

7 REPLIES 7
Reeza
Super User

Couple of things:

1. You typically don't model binary response data with GLM, but something like proc logistic or logistic regression

2. The Titanic data actually has 4 class variables 1, 2, 3 and crew

I'm not sure how to write the contrast statements b/c they drive me nuts, but a basic proc logistic will produce the results:

proc logistic data=titanic;

class class (ref='1')/param=ref;

model survived(event='1') = class;

run;

stats
Calcite | Level 5

Thank you. I wanted to test this at alpha 0.01? how can I do that.

Reeza
Super User

I believe, though not certain, when you test something with a particular alpha, you're checking to see if the p-value is above or below that value to make your judgement of significance.

Here's a good reference on contrast/estimate statements in SAS:

http://support.sas.com/resources/papers/proceedings11/351-2011.pdf

stats
Calcite | Level 5

Thank you everyone.

I asked my professor today and he told me to use this code

proc glm data=work.two;

class class;

model surviveds=  class ;

estimate 'class 1 vs. class 2' class  1 -1 0;

estimate 'class 2 vs. class 3' class  0 1 -1;

estimate 'class 1 vs. class 3' class  1 0 -1;

run;

and dis worked. just posting for info

Reeza
Super User

I'd ask about the fact that survived is a binary data point.  But hey, what do I know Smiley Happy

PGStats
Opal | Level 21

I'm glad to hear this is only a course problem and not part of some research as I would think that GENDER and AGE should also be included in the model. But hey, what do I know Smiley Happy.

PG

PG
stats
Calcite | Level 5

Hello reeza

I asked sas techncial support for help and even dey told glm is not used for binary data. They forwarded me with code using proc logistic. while i was discussing he did not clear this point. so i am still confused.

sas-innovate-2024.png

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.

 

Register now!

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.

Discussion stats
  • 7 replies
  • 1692 views
  • 1 like
  • 3 in conversation