Announcement

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

  • geonear r(459) error message advice

    Hi All,

    I am trying to calculate the distance of disaster occurrences from specific place names within a 50km radius.

    The code that I am using is:

    geonear place_name latitude_afro longitude_afro using "GDIS Geonear Test.dta", n(disastertype latitude longitude) ignoreself long within(50)

    and it is coming up with the following error: latitude_afro or longitude_afro not constant within place_name group r(459);

    I have tried two variables at the start of the code place_name and merge_location and they have each presented the same error.

    Any advice would be much appreciated.

    Cheers,
    Rob

  • #2
    geonear is from SSC (FAQ Advice #12). The error message seems to be very clear. You have one named location with different latitude-longitude coordinates.

    Code:
    bys place_name (latitude_afro longitude_afro): gen tag= (latitude_afro[1]!=latitude_afro[_N])|(longitude_afro[1]!=longitude_afro[_N])
    list place_name latitude_afro longitude_afro if tag, sepby(place_name)

    If you cannot resolve the issue from the above, present a data example using the dataex command following FAQ Advice #12.

    Comment


    • #3
      Thank you, Andrew.

      Comment

      Working...
      X