I think this will work:
-collapse (count) X-
Don't type the hyphens.  That is Statalist convention for indicating Stata
code.
Then save your data *with a different file name*.  Simply saving it will
replace your original data (although Stata will warn you about this.)
--Chris Ryan
Hi, everyone,
As a new user, could any one show me how to save the results as a data
file so that I can reuse it.
Say, I have  a variable (x) with many levels in a file. I want to get
the total count of each level in a file.
The codes;
Sort x;
By x: count;
Will produce the results on the screen, but I want it in a file like:
X	N
1	5
2	10
.....
Thank you
Shihe Fan
Epidemiologist
Office of the MOH
Public Health Division
Suite 300, 10216 - 124 Street
Edmonton AB T5N 4A3
Phone:(780) 413-7742
Fax: 	(780) 413-7950
[email protected]
*
*   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/
*
*   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/