Breaking & transforming 2 variables into percentage of whole

Moderators: statman, Analyst Techy, andris, Fierce, GerineL, Smash

georgethebear
Posts: 2
Joined: Wed Aug 01, 2012 3:58 pm

Breaking & transforming 2 variables into percentage of whole

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.
Penguin_Knight
Posts: 473
Joined: Thu Apr 05, 2012 5:58 pm

Re: Breaking & transforming 2 variables into percentage of w

What do "district A", "national A", "district B", and "national B" stand for? Are they sum, case number, or what?
georgethebear
Posts: 2
Joined: Wed Aug 01, 2012 3:58 pm

Re: Breaking & transforming 2 variables into percentage of w

The data set is individualised, but there is a field for each to show the district (of England). District A/B and national A/B would be numeric fields, created from calculations on the individual scores.

I'm trying not to go into too much detail but may need to, to give you an idea of what I'm doing. There are new geographical divisions coming in (like new districts) and I need to find a way of recalculating scores using the new divisions (which have different boundaries from the old ones). I think that doing so requires me to have a data-set that contains simultaneously the score for each (old) district for variable A, the national score for variable A, the district scores for variable B and the national score for variable B.

In addition, I'm trying to do it all in syntax just because that's the good practice at work. It would be a lot easier to copy and paste the weights across, since calculating them in MS Excel would be straight forward.
Penguin_Knight
Posts: 473
Joined: Thu Apr 05, 2012 5:58 pm

Re: Breaking & transforming 2 variables into percentage of w

We're still not getting each other's points.

Say this is how I envision your data:

Code: Select all

``````ID  RegA  RegB  SomeVariable?
1    1     1        ?
2    1     1        ?
3    1     2        ?
4    1     2        ?
5    2     3        ?
6    2     3        ?
7    2     4        ?
8    2     4        ?
10   2     4        ?``````
Each row is a subject, and each of them will have a variable which you called region A and region B that represent in which regions they were and they are currently living.

My questions are:
1) Why are there two nationals? Wouldn't they all be one nation? (Not familiar with how England divides its land). But I am guessing that Regions are smaller units withing "Nation", which operates like a province?
2) You kept saying "Score" of region, "Score" of nation... what is that score? Is it some kind of variables that is different for each individual?
3) Continued from 2, when you list the formula like "(district A/national A) as %", I am not sure what "district A" and "national A" represent. If I know all these, the syntax should be easy.

I guess it'd be best if you can just refer to your own data set and type up like 10 cases with numbers and region A and region B and all other stuff and tell me how you'd like new variable to look like. Otherwise I will let other users help you.

Who is online

Users browsing this forum: No registered users and 2 guests