Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Measuring distance between control and treatment villages

    Hey,
    I have a dataset containing the name of the villages, their coordinates (longitude and latitude) and a dummy variable representing the fact of being assigned to a program (1= treatetment, 0=control). I want to calculate the shortest distance of each "control" village to a "treated" one.
    I tried to use the command Geonear in the following way:

    geonear Village Latitude Longitude using "file", n(Village Latitude Longitude) ignoreself

    But of course it is calculating the shortest distance to ANY villages, not to just the control to a treated one. I wonder if there is an option to integrate the above-written formula, or if there is an other way to get to my goal.

    Thank you in advance for your help,

    Matteo

  • #2
    You could split your "file" (comparison) dataset into two datasets - one subsetted for control villages, one subsetted for Tx villages. Then for each treatment type in your Master file, you would run it against the opposite type's comparison dataset.

    Comment


    • #3
      Thank you for your answer.
      i already split into 2 datasets, the problem is that i was not able to run the command in a way that was comparing them. I solved the problem by first uploading on stata the "control" database, then i used the command "geonear" using only the treated database. In stata commands:


      import excel "name of the treated database file"

      geonear Village Latitude Longitude using "name of the control database file", n(Village Latitude Longitude) ignoreself

      Comment


      • #4
        Matteo Ghislandi - what you've done is what I was describing, albeit tersely. Glad you got it to work.

        Comment

        Working...
        X