Announcement

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

  • Geonear

    Hi,

    I have a dataset containing a household ID, latitude, and longitude variables, and I want to create a variable that counts the number of households within 1 km of each household. Geonear looks perfect, but I think it only works if you have a baseid and a nborid. In this case, I only have a baseid (household_id).

    I've tried:

    geonear household_id latitude longitude using "cashdata.dta", ///
    neighbors(household_id latitude longitude) long ignoreself within(1) near(0)

    but it tells me the identifier cannot be the same. Is there another way I can do this, or is this just the wrong command?


    Thanks in advance.
    Last edited by Amy Dilhon; 11 Jul 2018, 09:44.

  • #2
    All you need here is to change the name of the household_id variable in your "cashdata.dta" file and save it under another name before running geonear. This is quite typical for how one would use -geonear-.
    Code:
    use cashdata.dta
    rename household_id nbor_id
    save "nborfile.dta"
    use cashdata.dta, clear
    geonear household_id latitude longitude using "nborfile.dta"', ///
       neighbors(nbor_id latitude longitude) long ignoreself within(1) near(0)
    You could, of course use a -tempfile- for the neighbor file, which is what I would choose here, but that's up to you.

    Comment


    • #3
      Hello! I am looking to find weather station within 100k of given centroids, I have the data (centroids of districs, and weather/temp stations) in different dtas. Does can I do this directly with geonear?

      Comment


      • #4
        Hello i have got two datasets, data1 and data2. Data1 contains variable lsoa11, latitude and longitude while data 2 contains variable lsoa11, latitude1 and longitude, total income, supply teachers. I use the code geonear lsoa11 latitude, longitude using data 2, neighbours(lsoa11 latitude1 longitude1). Stata says lsoa11 not found. Please what do i do?

        Comment

        Working...
        X