Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Re: using "keep if"


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: Re: using "keep if"
Date   Fri, 3 Apr 2009 01:15:20 +0200

<>
This example from the help file works, even though it does not make too much sense. I have Version 1.2.0 - 14 March 2008

****
use "Italy-OutlineData.dta", clear
spmap using "Italy-OutlineCoordinates.dta", id(id) label(data("Italy-RegionsData.dta") select(keep if id<3 & id>1) xcoord(xcoord) ycoord(ycoord) label(relig1) color(white) size(*0.7))
****

-set trace on- to find the spot where Stata issues the error and report back to the list...


HTH
Martin
_______________________
----- Original Message ----- From: Vitorino, Maria Ana
To: [email protected]
Sent: Friday, April 03, 2009 12:36 AM
Subject: st: using "keep if"


Hi,
I am trying to use "keep if" to trim down the data that I want to use to label some observations on a plot.

Using "keep if" in the following command line seems to work:

spmap using "uscounty.dta" if state=="42", id(_ID) cln(2) ocolor(gs12 gs12)
fcolor(white white) legend(off) label(data ("coord.dta") select(keep if batch <3) y(lati) x(longi)
label(batch) ) title("Big Foot Sightings in Pennsylvania")

BUT, if I try to do the following:
...label(data ("coord.dta") select(keep if batch >3 & batch<6) y(lati) x(longi)...

I get an "invalid syntax" error...

How can I use the keep command with 2 conditioning statements?

Any suggestions are 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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index