Programming the statistical procedures from SAS

need help

Reply
New Contributor
Posts: 4

need help

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!

Grand Advisor
Posts: 16,880

Re: need help

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;

New Contributor
Posts: 4

Re: need help

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

Grand Advisor
Posts: 16,880

Re: need help

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

New Contributor
Posts: 4

Re: need help

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

Grand Advisor
Posts: 16,880

Re: need help

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

Respected Advisor
Posts: 4,606

Re: need help

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
New Contributor
Posts: 4

Re: need help

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.

Ask a Question
Discussion stats
  • 7 replies
  • 346 views
  • 1 like
  • 3 in conversation