Nick,
Thanks for all the comments-suggestions
Nikos
----- Original Message ----
From: Nick Cox <[email protected]>
To: [email protected]
Sent: Monday, May 11, 2009 4:06:14 PM
Subject: st: RE: RE: by and missing values question
That was an exaggeration on my part. You could set it up so that the
total results were only issued (say) on the last call. But I still
suggest just issuing it twice. -help byable- points to details, either
way.
Nick
[email protected]
Nick Cox
Question [2] is a good question. You could engineer your program so that
it always returned total results too, but the effect would inevitably be
that it did that every time round the loop. In practice I'd tend to
issue the command twice, once without and once with -by:-.
Nikolaos Kanellopoulos
I have written the following very simple program
cap pr drop logdiff
program define logdiff , rclass byable(recall)
syntax varlist(min=2 max=2) [if] [in] [fweight aweight]
version 8.0
tempvar dif
marksample touse
qui count
local N = r(N)
qui count if `touse'
if r(N) == 0 error 2000
local n = r(N)
qui gen `dif' = (`n'/`N')*abs(ln(`2') - ln(`1')) if `touse'
qui su `dif' if `touse' [`weight'`exp'] , meanonly
loc diff = r(mean)
di as text "Log Difference: " as result `diff'
return scalar diff = `diff'
return local N = `N'
return local n = `n'
end
My questions are:
[1] How can I return the results for all categories when I use the by
option and not only for the last category?
[2] How can I display and return the results for the total of a category
when I use the by option? i.e. return the same results as without the by
option.
[3] How can I exclude the missing values from my estimations both when I
use and not use the by option?
*
* 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/
___________________________________________________________
Χρησιμοποιείτε Yahoo!;
Βαρεθήκατε τα ενοχλητικά μηνύματα (spam); Το Yahoo! Mail
διαθέτει την καλύτερη δυνατή προστασία κατά των ενοχλητικών
μηνυμάτων http://login.yahoo.com/config/mail?.intl=gr
*
* 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/