Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: RE: basic commands question


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: basic commands question
Date   Thu, 6 May 2004 11:56:49 +0100

Nick is correct. I overlooked this crucial 
detail! The parentheses only make sense 
in some context like 

. by <varlist> ( <varlist2> ) : ... 

so that 

. by (<varlist2>) : ... 

is meaningless to Stata, irrespective
of sort order. 

I think it remains true that something 
like -contract- is your best approach 
to produce another dataset of frequencies. 

Thanks to those who refrained from referring
me to the tutorial on -by:- in SJ 2(1) 2002. 

Nick Winter

> > > Or..
> > > why does the following code not work?
> > >
> > > . by (var1 var2): egen freq=count(var3)
> > >
> > > I want to count the number of occurences  (var3) for each
> > > year for each
> > > country.  how do i save this reorganized result in a .dta file?
> 
> You need to omit the parentheses:
> 
>          . by var1 var2: egen freq=count(var3)
> 
> (And be sure you've previously sorted on var1 var2).

*
*   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/



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