Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: using spmap and option "point"
From
Maurizio Pisati <[email protected]>
To
[email protected]
Subject
Re: st: using spmap and option "point"
Date
Tue, 02 Mar 2010 08:11:15 +0100
Dear Ana,
your only chance is to add a variable that identifies regions to
"file2.dta", and then use it in suboption -point()- to select only the
stores located in regions B or C. To generate such variable, you might
want to use a point-in-polygon algorithm -- an example of which, coded
in Mata as function -sp_pips-, can be found in the -spgrid- Stata
program (ssc install spgrid).
Best wishes,
Maurizio
Il 01/03/10 09.35, Vitorino, Maria Ana ha scritto:
Dear statalist users,
Is the following possible?
I have 2 files:
*file1 is something like:
region populationsize id
A ... 1
B ... 2
C ... 3
(I also have a file with the region coordinates so that I can use spmap)
*file 2 is something like:
store_id xcoord ycoord
100 ... ...
201 ... ...
345 ... ...
411 ... ...
544 ... ...
I would like to do a map with the stores superimposed on the map but only for the stores that are located in region B or C (note that I don't have that information on file2, otherwise it would be easy to do), excluding store 345 (irrespective of where it is located).
If I do something like the following, the problem is that all the stores (even the ones that are not located in regions B or C) show up...and I only want the ones located in regions B or C.
spmap populationsize if region=="B" | region=="C" using file1coord, id(id) point(data("file2.dta") xcoord(xcoord) ycoord(ycoord) fcolor(emerald) select(drop if store_id==345))
How can I modify this command line to achieve what I'm looking for?
Any help is appreciated.
Thanks!
Ana
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/