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: byable returns : return list after by prefix
From
Austin Nichols <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: byable returns : return list after by prefix
Date
Thu, 22 Aug 2013 18:17:01 -0400
László Sándor <[email protected]>:
Lost cause, but you can write your own byable program... but probably
faster to use Mata.
clear all
sysuse auto
expand 100000
prog mymns, byable(recall, noheader)
syntax [varlist] [if] [in]
marksample touse
sum `varlist' if `touse', mean
mat A=nullmat(A)\r(mean)
end
set rmsg on
sort rep78
by rep78:mymns mpg
mata:
st_view(Vid=.,.,("rep78"))
st_view(V=.,.,("mpg"))
info=panelsetup(Vid, 1)
B=J(0,1,0)
for (i=1; i<=rows(info); i++) {
panelsubview(SV=., V, i, info)
B=B\mean(SV)
}
mata:st_matrix("B",B)
end
mat li A
mat li B
On Thu, Aug 22, 2013 at 5:05 PM, László Sándor <[email protected]> wrote:
> Hi all,
>
> I am at a loss how to use the results of a
> -bys v1: sum v2, meanonly-
> run (try it on sysuse auto). -return list- shows only the stats from
> the last category. No results are displayed with the run either. Is
> there a trick, or this is a lost cause?
>
> Thanks,
>
> Laszlo
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/