I am currently experiencing a problem with the construction of a variable.

Please consider the following: There are multiple cars in a city i. Further consider that the number of cars in city i depends on a weighted measure as given on the right hand side below (whereas i does not equal j)):

Cars in city i = ... + SUM of [ (Cars in city j / Cars in all cities) x car dealer in city j ] over all j's.

Please note that there is a variable car_loc indicating that a car is registered in a specific city.

We are now interested in constructed the variable on the right hand side which, as far as I can tell, consists of three parts : (i) the sum of all cars in cities j (ii) the sum of cars in all cities (iii) and the sum of gas stations in cities j.

Thank you for all your help in advance.

Regards,

The Economist.