Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: More than 2 arguments for by


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: RE: More than 2 arguments for by
Date   Tue, 16 Sep 2008 11:31:57 +0200

Well, the syntax diagram for -by- allows a varlist

******************
sysuse auto, clear
by foreign rep78, sort: summarize price
g t=price>10000
ta t
by foreign rep78 t, sort: summarize price
g r=gear>3
ta r
by foreign rep78 t r, sort: summarize price
by foreign rep78 t r, sort:keep if _n==_N
*******************



HTH
Martin




-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Ashim Kapoor
Sent: Tuesday, September 16, 2008 11:21 AM
To: [email protected]
Subject: st: More than 2 arguments for by

Hello everyone:

I want to do the following :

sort year state cnum votes

by year stata cnum votes : keep if _n==_N

That way I get the guy with the max no of votes.

Now when I do this for 1 or 2 arguments for by then it works, but not
for 4 arguments I have . Does by have a limit on how many arguments it
can have ?

I read -help by- and that does mention using by in the following
fashion : -- > by year ( state) . Do I need to put in brackets for the
other arguments?

Could someone please clarify?

Thank you,
Ashim.
*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index