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: egen anycount
From
daniel klein <[email protected]>
To
[email protected]
Subject
Re: st: egen anycount
Date
Thu, 19 May 2011 00:35:49 +0200
I am not aware of a command, but it should not be hard changing the
existing -anycount-. Here's an ad hoc step-by-step
1. locate -anycount- and open it in the do-file editor
. findfile _ganycount.ado
. doedit "`r(fn)'"
2. change the file (don't save the changes yet)
2.1 change line 2 form
"program define _ganycount"
to
"program define _ganycount2"
2.2 change line 7 from
"[...] , Values(numlist int) /*"
to
"[...] ,Values(numlist) /*"
2.3 change line 26 from
"*/ if ``i'' == `nj' & `touse'"
to
*/ if ``i'' == float(`nj') & `touse'
3. save the file as _ganycount2.ado to your "personal" folder
(to locate type: -di c(sysdir_personal)-) or alternatively to your
"plus/_/" folder (locate: -di c(sysdir_personal)-)
4. -discard- Stata
5. use your -anycount2- function
. egen somevar = anycount2(varlist), values(1.2 0.8 1.5)
Best
Daniel
*
* 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/