This is my first post on this forum. I've come here because I'm stuck.

My data-set is at individual level. There is a main divider, which we might as well call "District" (close enough to the truth)

There are two variables in the data-set that I want to use as part of a weight to be applied at individual-level. (There are numerous other variables in the data-set)

Both of these variables are numeric. I shall call them A and B.

I want my weight to be:

(district A / national A) as %

---------------------------

(district B / national B) as %

I don't know how to do this. I know how to create a new data-set that totals A and B by district, so that I can see how many of A and B are in each district. In addition, I know how to create outright totals of A and B, which are in effect national totals. What I can't work out is how to put the two together in a way that would allow me to divide each district total by the national total and get a percentage.

Once I get a percentage for A and a percentage for B, I can work out my weight for each individual.

If anyone can help me with this, I shall be extremely grateful.