Hi,
I'm using Intercooled Stata 8, and am not an experienced user.
It will be great if someone can help me out with this.
I have a dataset where I have about 18,000 records each having a value for X
and another for Y that ranges from 1 to 32.
I have another 32*32 matrix that gives the distances between all X and Y
pairs.
Whenever a record has X=Y, I want to introduce a new variable distance =
zero.
Otherwise, I want to assign distance = the appropriate distance value for
(X,Y) from this matrix I have.
For example, if X=1 and Y=1, distance = 0.
If X=1 and Y=2, distance = 25 (value obtained from the distance matrix)
If X=2 and Y=1, distance = 25 (same as above)
If X =1 and Y=3, distance = 15 ...... And so on.
Can someone please suggest the most efficient way to do this in Stata?
Many thanks,
Anjali
------------------------------
Anjali Mahendra
Doctoral student
Department of Urban Studies and Planning
Massachusetts Institute of Technology
------------------------------
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/