Help using Base SAS procedures

Query for dummy coding with females as a reference group.

Reply
Occasional Contributor
Posts: 14

Query for dummy coding with females as a reference group.

Hello all, please help this question or any link for similar examples.


Q. A researcher is interested in predicting self-esteem(RESE) among University students. He believes that self-esteem can be predicted based on overall stress and happiness levels as well as gender.  Using an appropriate PROC procedure and dummy coding with females(1) as a reference group, run a following model using SAS:

RSESi=b0 + b1*Genderi + b2*Stress_i +  b3*Happiness_i +  b4*Gender_i*Happinessi + e_i

IDbfiebfiabficbfinbfioRSESgenderhappinessstressairscompautprocautrelorIDFburnoutrelqualautaware
13.6253.111113.555563.1254.12.913.503333.272736.682692.93.166672.8753.503339.42863
23.54.111113.888893.53.9423.78194.54.0833333.7815.33333.83333

Thanks in advance.

Regular Contributor
Posts: 151

Re: Query for dummy coding with females as a reference group.

This is clearly a homework type question.  Why not try researching it first, running some code and then post a question on here if the code doesn't work?

Trusted Advisor
Posts: 2,115

Re: Query for dummy coding with females as a reference group.

Newmkka,

To follow-up on Keith's comments, a good place to start your research would be with a couple of Google searchs:

dummy coding reference group

dummy coding reference group site:sas.com

Doc Muhlbaier

Duke

Occasional Contributor
Posts: 14

Re: Query for dummy coding with females as a reference group.

Hello, I made a dummy variable and run a model in SAS:

data dummy;

set work.Datafile;

    d1 = 0 ;

if gender = "1" then d1 = 1 ; <------- here is right? females(1) reference?

run;

data dummy;

set work.dummy;

Gender_Happiness = gender*happiness;

run;

proc reg data = work.dummy;

  model rses = gender stress happiness Gender_Happiness;

run;

Something wrong can you see? Please collect it. Thanks in advance.

Super User
Posts: 19,789

Re: Query for dummy coding with females as a reference group.

Is females 1? If so, that isn't correct.

See the link below.

FAQ: What is dummy coding?

Occasional Contributor
Posts: 14

Re: Query for dummy coding with females as a reference group.

Thanks your help. Even though I read it, I don't know which part should I modify. Can you help me?

Thanks

Respected Advisor
Posts: 2,655

Re: Query for dummy coding with females as a reference group.

What about:

proc glm data=work.datafile;

class gender(ref=first);

model rses=stress happiness gender gender*happiness/solution;

quit;

PROC GLM is designed for exactly this kind of regression, and the use of the ref= option in the class statement makes it easy to set females as the reference class.

Steve Denham


Occasional Contributor
Posts: 14

Re: Query for dummy coding with females as a reference group.

Posted in reply to SteveDenham

Thanks for your code. But it has syntax error ("ref=") this. gender value are both 1 and 2. and want females as a reference group. So I use (ref=1). But it doesn't work. Can you help me more?

Respected Advisor
Posts: 2,655

Re: Query for dummy coding with females as a reference group.

What do you mean by "it doesn't work"?  Could you please share your results?  If females are coded in gender as 1, they are first in the category, and so there should be no problem.  It may be just a problem in interpreting the output.

Steve Denham

Occasional Contributor
Posts: 14

Re: Query for dummy coding with females as a reference group.

Finally I got the results. Can you help to interpret these questions? If wrong, collect it please.

1.      Is the overall model significant? Report your finding using APA format.

The overall model is significant, F(11.15) , p = <.0001


2.      Determine which coefficients are statistically significant. Report your findings using APA format.

Happiness is significant (p<.0001), stress is also significant, (p=0.0011), gender*happiness is also significant (p=0.0299). Also dummy code is significant (p=0.026


3.      What is an average level of self-esteem for males?

An average level of self-esteem is 2.39629. (actually I run it again with male as a reference) How to get it without running code again?


4.      What is the estimated effect of happiness and what does it mean?

Happiness Coefficient – For Female (reference group), one unit increase in a number of happiness results in increasing self-esteem by 1.0193


5.      What is the estimated effect of stress and what does it mean?

Stress Coefficient – One unit increase in a number of happiness results in increasing self-esteem by -0.17877


6.      What is the estimated effect of gender and happiness and what does it mean?

Interaction Term (Gender and happiness) - One unit increase in a number of happiness results in increasing self-esteem by -0.61991.


Interaction Term (Gender and happiness) – Since that is an additive effect we could calculate a (1.01936 + (-0.61991) = 0.39945). One unit increase in a number of happiness results in increasing self-esteem by 0.39945.


(which one is correct?)


7.      What is the estimated main effect of gender and what does it mean?

Male have 2.16998 higher values compared to female.


8.       Based on an appropriate statistic determine a model fit. Report your findings.

Based on an R-Square value, the IVs predict an amount 20 percent DV.

dummy.png

Respected Advisor
Posts: 2,655

Re: Query for dummy coding with females as a reference group.

This has obviously developed into a homework/take home exam question.  Interpretation is left to the analyst.

Steve Denham

Ask a Question
Discussion stats
  • 10 replies
  • 493 views
  • 0 likes
  • 5 in conversation