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

Hi,

 

This is a stats/PROC SURVEYREG question related to fixed effects models.

 

I am using PROC SURVEYREG to estimate graduation rates.  The model includes fixed effects for schools and a continuous running variable called RANK, which is a number that schools assign students based on their middle school GPA and test scores.  

 

What I want to know is how do I calculate an estimated overall average graduation rate for a particular value of RANK.  Currently, I know that intercept actually represents one of the school indicator variables that was dropped due to multicollinearity.  

 

Here is an example of the code. 

PROC SURVEYREG DATA = HAVE;
    CLASS SCHOOL;
    MODEL GRADUATION = SCHOOL + RANK / SOLUTION;
RUN:


What I want to know is, for example, what would be the overall average graduation rate for a given value of RANK such as RANK = 10.

 

Thanks for any help.  Please let me know if there is any additional information I can provide. 

 

Sincerely,

 

Bill

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
SteveDenham
Jade | Level 19

PROC SURVEYREG supports the LSMEANS statement.

 

Try adding this line to your code:

 

LSMEANS school / AT rank= <insert the given value of rank that interests you.  You can have several LSMEANS statements each with a different rank value>;

 

This would give the marginal means at a given rank for each of the schools.  Using an ODS OUTPUT statement you could get these into a dataset.   From these, a weighted mean could be calculated using SURVEYMEANS with a BY statement.  You may have to merge (or use SQL) to get the cluster variable DISTRICT on the marginal means dataset. In PROC SURVEYMEANS this would become a STRATA variable. I know this seems kind of round-about, but I don't see a way to obtain the higher level (overall) adjusted means staying with just SURVEYREG.

 

SteveDenham

View solution in original post

3 REPLIES 3
ballardw
Super User

I am curious why you are using Surveyreg if you do not have a complex sample design. You don't show any of the sample design information that Surveyreg would expect to have for a complex design.

 

 

whs278
Quartz | Level 8

That is a good question.  There is some weighting involved, and we are also clustering standard errors.   In the previous example, I was trying to simplify the code a little bit, but the actual code looks more like this.  

 

PROC SURVEYREG DATA = HAVE;
   CLUSTER DISTRICT;
   CLASS SCHOOL; 
   MODEL GRADUATION = SCHOOL RANK / SOLUTION;
   WEIGHT WEIGHTS;
RUN; 
SteveDenham
Jade | Level 19

PROC SURVEYREG supports the LSMEANS statement.

 

Try adding this line to your code:

 

LSMEANS school / AT rank= <insert the given value of rank that interests you.  You can have several LSMEANS statements each with a different rank value>;

 

This would give the marginal means at a given rank for each of the schools.  Using an ODS OUTPUT statement you could get these into a dataset.   From these, a weighted mean could be calculated using SURVEYMEANS with a BY statement.  You may have to merge (or use SQL) to get the cluster variable DISTRICT on the marginal means dataset. In PROC SURVEYMEANS this would become a STRATA variable. I know this seems kind of round-about, but I don't see a way to obtain the higher level (overall) adjusted means staying with just SURVEYREG.

 

SteveDenham

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 3 replies
  • 775 views
  • 2 likes
  • 3 in conversation