| |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: problems with e(sample)
At 04:22 PM 6/16/2006, Zurab Sajaia wrote:
Hi all,
I ecountered a problem with disapearing e(sample) and couldn't find
what can be wrong:
I have an eclass program, which sets leaves some ereturn parameters
as well as setting e(sample)
program myprogram, eclass
...
ereturn post, esample(`touse')
ereturn local cmd="myprogram"
...
count if e(sample)
end // myprogram
When I run the program -count- within the program displays correct
number but if I write
.count if e(sample) from command line, it returns 0. Somehow
e(sample) gets cleared although other parameters, for example e(cmd)
still contains "myprogram".
We might need to see a little more code here. Here is my version of
myprogram.ado:
program myprogram, eclass
tempvar touse
gen `touse' = 1
ereturn post, esample(`touse')
ereturn local cmd="myprogram"
count if e(sample)
end
Here it is in action:
. sysuse auto
(1978 Automobile Data)
. myprogram
74
. count if e(sample)
74
So, it seems to work fine for me. i also tried
gen `touse' = foreign
and that worked fine too, yielding counts of 22. So, I don't think
there is an inherent problem, but something else in your code may be
zapping things.
-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
FAX: (574)288-4373
HOME: (574)289-5227
EMAIL: [email protected]
WWW (personal): http://www.nd.edu/~rwilliam
WWW (department): http://www.nd.edu/~soc
*
* 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/