BookmarkSubscribeRSS Feed
RyanDHS
Calcite | Level 5

I have data at the level of US Counties (level 1) nested within their respective State (level 2) and I have both predictors at the county level and the state level. My understanding was always that Proc Mixed determines the level of the variable in the model based on whether there is variability at each level. In this example, I have the population of the county (pop10) as a predictor and the way the state votes relative to others (CPVI), both ratio scales. My syntax is below:

 

proc mixed data = sor covtest ;
class STATE ;
model SORgc = pop10 CPVI /s DDFM=sat ;
random int / sub=STATE ;
ods output SolutionR = Res2;
run;

 

The ODS output fails because there are no level 2 residuals and the degrees of freedom suggest it is treating my level 2 variable CVPI as a level 1 predictor. I've attached the data file. I've checked that there is no variance in the variables at the state level (see second tab in excel sheet) and made sure everything is a number and everything I can possibly think of. SAS is doing the grouping right because it shows the number of subjects correctly (not all states are included).  Am I missing something really obvious?

RyanDHS_0-1723061343079.png

RyanDHS_1-1723061646454.png

 

 

1 REPLY 1

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 425 views
  • 0 likes
  • 2 in conversation