Dear Statalist,
I have been looking for a solution with respect to running a number of consistency checks on multi-level data.
My data consists of two-level variables (individual and the school they attend) in long form across a series of waves.
What I want to do is confirm that certain variables take the same value within school.
For instance the % of students within a school who are of an ethnic minority should be constant across all those attending said school.
A tedious solution I came up was to do the following:
sort School_ID
by School_ID, sum School_Level_Variable if sample == 1
Luckily all my exogenous variables are drawn from one wave with the outcome in another.
Still I do have some 4k observations with about 600 schools.
So you can imagine checking 600 summations manually is rather tedious and human error prone.
There must be a more elegant solution.
I am using Stata 14.0
Hope you can help,
Jack.
Comment