Statalist The Stata Listserver

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

Re: st: Save results as a data file

From   Ronnie Babigumira <>
Subject   Re: st: Save results as a data file
Date   Fri, 15 Sep 2006 22:44:18 +0200

But wouldn't this give one value which is just the total count of x not the counts for the different levels? wrote:
I think this will work:

-collapse (count) X-

Don't type the hyphens.  That is Statalist convention for indicating Stata

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:

1	5
2	10

Thank you

Shihe Fan
Office of the MOH
Public Health Division
Suite 300, 10216 - 124 Street
Edmonton AB T5N 4A3
Phone:(780) 413-7742
Fax: 	(780) 413-7950

*   For searches and help try:

*   For searches and help try:

*   For searches and help try:

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