Hi,
Does anyone know who to get the total number of subjects within each level of a specific CLASS variable from a mixed model (PROC MIXED)?
Note, this is not in reference to ods output=nobs or ods output=dim...but rather a more granular/extended version of ods output=dim that can actually provide how many unique subjects are in each group from a CLASS variable of interest.
Agreed. SAS support confirmed there is no option for this.
Since I am only interested in the number of subjects with complete data (sufficient information) to predict Y at a given visit for each treatment group, I am using a simple descriptive frequency (proc sql and/or proc freq) of the count of unique subjects with non-missing data across all the variables included in the mixed model (excluding the outcome/dependent variable).
According to SAS:
"PROC MIXED does require non-missing values for the dependent variable for the model estimation. In other words, if an observation has a missing value for Y, it will not be included in the model estimation. However, you might obtain the predicted value for this observation, as long as all the independent variables in the model are non-missing. So you might want to modify how you count the subjects in your program, if the count is for the model estimation purpose."
Maybe there's a way to do this in PROC MIXED, but the first thing that comes to mind is that PROC FREQ will provide the answer easily.
Agreed. SAS support confirmed there is no option for this.
Since I am only interested in the number of subjects with complete data (sufficient information) to predict Y at a given visit for each treatment group, I am using a simple descriptive frequency (proc sql and/or proc freq) of the count of unique subjects with non-missing data across all the variables included in the mixed model (excluding the outcome/dependent variable).
According to SAS:
"PROC MIXED does require non-missing values for the dependent variable for the model estimation. In other words, if an observation has a missing value for Y, it will not be included in the model estimation. However, you might obtain the predicted value for this observation, as long as all the independent variables in the model are non-missing. So you might want to modify how you count the subjects in your program, if the count is for the model estimation purpose."
This blog by Rick Wicklin ("Examine patterns of missing data in SAS") might be of interest to you
https://blogs.sas.com/content/iml/2016/04/18/patterns-of-missing-data-in-sas.html
Thank you for sharing. This will be a useful cross-check against proc sql and/or proc freq when getting the CLASS levels Ns.
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!
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.