Hello. This seems like it would be straightforward but as an advanced beginner I am having a hard time figuring this one out. I am trying to generate new variables that will be used as my pweight. These will be the inverse of the sum of the number of females age 10-14 and males age 10-14 in each school out of the total population surveyed. I I have 3 variables of interest: SchoolName, Age, Sex. SchoolName has 30 different school names, Age is a continuous variable and Sex is male or female. Any insight how to do this would be greatly appreciated.

Thanks,
Adam