Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: error message r(2000)


From   "louis boakye-yiadom" <[email protected]>
To   [email protected]
Subject   Re: st: error message r(2000)
Date   Thu, 31 Mar 2005 13:21:29 +0000

I've tried giving the -count- command again within the do file, using the actual list of variables in `varlist', separated by commas, and the result is 0. So there are actually no observations. I've got to figure out why there are no observations. Thanks a lot, Kit, Ronan, and Roger for your help.

Louis




From: Roger Harbord <[email protected]>
Are you running the -count- command inside the do-file which defines `varlist'? If not (e.g. you're running it from the command-line) then `varlist' will not be defined as it's local to the do-file, and missing() with no args is always true. If `varlist' contains >1 variable then missing(`varlist') shouldn't in fact work as missing() takes a comma-separated list not a varlist:

. local varlist price mpg rep78 headroom

. di "`varlist'"
price mpg rep78 headroom

. count if ~missing(`varlist')
pricempgrep78headroom not found
r(111);

. count if ~missing()
74


Roger.

--
Roger Harbord
Department of Social Medicine, University of Bristol
http://www.epi.bris.ac.uk


--On 31 March 2005 13:14 +0100 Ron�n Conroy <[email protected]> wrote:


louis boakye-yiadom wrote:

Dear All,
I get a "no observations" error message -r(2000)- when I execute a do
file,
and I'm having difficulty determining what's going wrong. According to
the
error message, I "have requested some statistical calculation and
there are
no observations on which to perform it. Perhaps you specified if exp
or in
range and inadvertently filtered all the data." I don't understand
what is
meant by "filtered all the data". The line that generates the error
message
is:
regress lnW `varlist' if migst1==0
To check whether there are actually no observations, I gave the following
command (and had the shown output):
count if migst1==0 & !mi(`varlist')
2720

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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