Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Creating index relative to other observations


From   "Frederick Guy" <[email protected]>
To   <[email protected]>
Subject   st: Creating index relative to other observations
Date   Thu, 29 Apr 2010 18:51:49 +0100

I have need to use information from all observations (about 1800 of
them) to create a new variable.

The variable created is a weighted sum of the inverse of geographical
distances between observation i and all j n.e. i. I have longitude and
latitude for each observation, and computation of the distance from any
i to any j is straightforward. What I don't know is how to get Stata to
loop over all observation and sum up the results.

For every observation i, I think I need to

(a) loop through all j n.e. I, doing computations involving variables
x1, x2(i) and x1, x2(j), and then

(b) sum up the results of these computations, returning a value which
becomes variable x3 for that i.

I expect there's a straightforward way to do this. Any suggestions?


Frederick Guy
Senior Lecturer
Department of Management
School of Business, Economics, and Infomatics
Birkbeck College, University of London
Malet St
London WC1E 7HX



*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index