Thank you Both, Martin and Albert. But I was trying to avoid using collapse as it creates trouble when the some of the data generated is empty. Is there anyway to save the output from table or tabstat, or it's simply not possible?
Shuaizhang
--- On Wed, 4/8/09, Lee, Albert <[email protected]> wrote:
> From: Lee, Albert <[email protected]>
> Subject: st: RE: how to save output from TABLE or TABSTAT as a stata .dta data file
> To: [email protected]
> Date: Wednesday, April 8, 2009, 2:58 PM
> This may not be elegant, but try:
>
> preserve
>
> collapse (sum) b, by(a)
>
> save filename, replace
>
> restore
>
> I hope it helps.
>
> Albert.
>
> Albert J. Lee, Ph.D
> Economist
> Summit Consulting LLC
> [email protected]
> (202) 402 7562
>
>
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]
> On Behalf Of Shuaizhang
> Feng
> Sent: Wednesday, April 08, 2009 2:51 PM
> To: [email protected]
> Subject: st: how to save output from TABLE or TABSTAT as a
> stata .dta
> data file
>
> Dear all:
>
> I am wondering if anyone knows how to save table output
> from TABLE or
> TABSTAT to a stata data file.
>
> For example, I have used
>
> . table a, c(sum b)
>
> to generate a list of summary statistics:
>
>
> a sum(b)
>
> 1 19372
> 2 102820
> 3 21403
> 4 19001
> 5 82549
> 6 15664
> 7 83616
> 8 50149
>
>
> How do I save this and maybe change the name of the two
> variables for
> later use.
>
> Thank you very much.
>
> Shuaizhang
>
>
>
> *
> * 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/
>
*
* 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/