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

st: RE: basic commands question


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: basic commands question
Date   Wed, 5 May 2004 20:13:36 +0100

Yihong Ni
 
> I have a questions about using stata8:
> Is there any way to save the results of tabulate command in 
> another .dta file?

-tabulate- does all sorts of things. If you wish to 
save frequencies to a data file, check out -contract- 
(having first -save-d your data). 
 
> 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?

I can see no reason why that shouldn't work, 
provided that you have previously 

. sort var1 var2 

and that -var1 var2 var3- are variables in your 
data. 

As before, you can

. contract var1 var2 var3 
. save freq 


*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index