I am looking for a way to take a subset of a data table that uses only rows matching a specified condition, and subtract the mean of those rows from a column.
For example, using the Big Class data set, say I want to create a new column showing "Difference in height between this student and the average 14-year-old of the same gender."
The way I know how to do this is by adding a second table, using Tables -> Summary -> Statistics: Mean(height), Group: sex, Subgroup: age. Then I can Table -> Update: Big Class By (sex), Match columns: sex = sex, and that will add several columns for Mean(height, [age]). Then I can create a new column "Delta height vs 14yo of same sex" that is :height - :Mean(height, 14).
My question: is there any way to do with without creating an extra table, and the extra column (e.g. "Mean(height, 14)")? It seems like Col Mean(x, byVar) is close to providing this functionality, but lacking the functionality to select a different group; for example I could use :height - Col Mean(:height, :age, :sex) to find the delta between student X and the average student of their own sex and height, but I don't know if there's a way to specify in Col Mean that I want to only consider rows with age=14, rather than using the age value associated with that row.
I do this type of normalization very frequently, so anything to make it faster and easier would be enormously appreciated!