First, thank you for all of the help. I want to mention again that my issue is partially resolved, I have the student-level n's. I will address the points you raised here to clarify my remaining problem. 1) I have tried the code suggested by @SteveDenham, @Rick_SAS, and yourself and I will attempt to clarify the issue I was referring to in my previous reply. As an example, when I amend the code that you helpfully provided to only examine the instructor_number variable and gender (for the sake of this discussion), it provides the table below: Instructor_Num Inst_gender Frequency Percent CumulativeFrequency CumulativePercent1 female2 male 22 22.22 22 22.22 77 77.78 99 100.00 In reality, the instructor_num is a grouping variable and inst_gender is a level-2 variable—so there are actually only one female instructor (instructor_num = 1) and one male (inst_number = 2) in the sample dataset. More details are provided below. As a note, the code provided by the other contributors has the same issue. It outputs the raw number of times observations appear—which does not provide the information I need for my level-2 variables. 2) Your example data shows dozens of records where the instructor is female anything that does not directly tie the instructor id to gender will do that. Which likely means that you did not describe the requirement carefully enough. 2) This point gets to the fundamental issue that I am having. The data are nested. In the dataset, each row represents one student (which is typical, of course). However, the variables that relate to instructors are at level 2 and grouped by the Intructor_Num variable. In the PROC MIXED function, on the random line of my code (re-posted below), the sub= line tells SAS that Instructor_ID is the grouping variable that the rows of data are nested within (it need to be in the CLASS statement as well). The nested structure has not been taken into consideration using the methods suggested so far (at least as far as I have been able to work out). In my sample dataset, the first 22 rows all have instructor_num = 1. Similarly, inst_gender and inst_inter also have all 1s for the first 22 rows. In my multilevel model, SAS identifies that all rows (students) where instructor_num=1 refer to students who had Instructor 1 as a teacher who is a female, non-international instructor. This allowed me to use the PROC MIXED function. However, the result is that the recommended procedures to "count" the observations do not work at the teacher level since an instructor with 22 students will have their gender indicated 22 times, and this would be the case for each instructor. So, yes, I understand your point that when you open the dataset, it appears as though there are dozens of records where the instructor is female—but since they are all Instructor 1, it refers to one person. Ultimately, I have over 50 instructors who are teaching +1,000 students in the complete dataset. The instructor number and the other categorical demographics for each instructor are provided for every row in the dataset (i.e., every student). Is there a way to examine the n's for the different levels of these teacher variables? Please note that I don't need to see interactions among them. For example, I would need the number of female/male instructors and the number of international/domestic instructors, but not an interaction between the two demographics (inst_gender*inst_inter). 3) I apologize for only sharing Excel files. SAS University Edition does not allow me to export .sas7bdat files and I was not sure of a better way to share a subsample of my larger dataset. Before my initial post, I worked for hours to find a way to export the more accessible SAS dataset to post in this forum; and I attempted to do so again after reading your reply. Unfortunately, I have still not been able to export data to a SAS data file. I've tried several methods, including attempting to export from SAS to .sas7bdat and SPSS to .sas7bdat, as well as other SAS data formats. I doubt this will be more helpful, but I've attached an SPSS datafile in this post in case it is somehow more usable. Previously-posed multilevel SAS code for reference since I refer to it in this reply: title SAS help 100 obs;
proc mixed covtest;
class Instructor_Num rGender rClass Inst_gender Inst_inter;
model cred_trust = rGender rClass Inst_gender Inst_inter /solution cl ddfm=Satterthwaite;
random intercept / sub=Instructor_Num cl type=vc;
... View more