Announcement

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

  • spmap: several observations per identifier; id() does not uniquely identify the observations;

    Hi,

    I am currently trying to plot a map with several observations for each district (polygon, I guess), I am interested in the number of observations for each district and have therefore created a variable that counts each observation by district and inserts it into a new variable:

    Code:
    bysort id: gen investcount=_N if contractsize !=.

    I have merged my data on "contractsize" with the db data set so that for observations from indentical areas the identifier is repeated.

    I then plot the map using
    Code:
    spmap investcount using "zmb_admcoord", id(_ID) ///
     fcolor(Reds2) ocolor(dkgreen) osize(thin) ///
     line(data("zamcoord_road") by(type) ///
     color(Greens) size(medium ..) ///
     legenda(on)) legend(position(2))
    However now my _ID is no longer unique.

    Could someone please show me how I fix this?
Working...
X