Programming the statistical procedures from SAS

How to include fixed effects with PROC SURVEYREG?

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 9
Accepted Solution

How to include fixed effects with PROC SURVEYREG?

I know PROC SURVEYREG can incorporate clustering and fixed effects. However, I'm a bit confused as to how to include fixed effects. My understanding is, the CLASS command creates dummy variables for the categorization variable / fixed effect variable. But do I then include that variable in the model command?

 

For example, let's say var2 is my fixed effect. Do I...

 

proc surveyreg data=data;
class var2;
model y = var1 / solution;
run;

Or do I...

proc surveyreg data=data;
class var2;
model y = var1 var2 / solution;
run;

I think it is the second one, but running the first one does not provide the same coefficient estimates as if I run it without the CLASS command, so the CLASS command must be doing something other than just creating dummy variables?

 

Thanks!


Accepted Solutions
Solution
‎10-03-2016 10:01 PM
Respected Advisor
Posts: 4,606

Re: How to include fixed effects with PROC SURVEYREG?

Look at the Data Summary Table. Most likely, including the CLASS statement decreases the Number of Observations count. Missing class levels are excluded from analysis, even if they are not part of the model.

 

Example:

 

data classMissing12;
set sashelp.class;
if age=12 then call missing(age);
run;

proc surveyreg data=classMissing12;
class age;
model weight = height / solution;
run;

proc surveyreg data=classMissing12;
*class age;
model weight = height / solution;
run;
PG

View solution in original post


All Replies
Solution
‎10-03-2016 10:01 PM
Respected Advisor
Posts: 4,606

Re: How to include fixed effects with PROC SURVEYREG?

Look at the Data Summary Table. Most likely, including the CLASS statement decreases the Number of Observations count. Missing class levels are excluded from analysis, even if they are not part of the model.

 

Example:

 

data classMissing12;
set sashelp.class;
if age=12 then call missing(age);
run;

proc surveyreg data=classMissing12;
class age;
model weight = height / solution;
run;

proc surveyreg data=classMissing12;
*class age;
model weight = height / solution;
run;
PG
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 359 views
  • 1 like
  • 2 in conversation