[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
"Martin Weiss" <martin.weiss1@gmx.de> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
WG: st: RE: how to save output from TABLE or TABSTAT as a stata .dta data file |

Date |
Thu, 9 Apr 2009 17:26:40 +0200 |

<> I am forwarding this email by Feng to let the list know the status of this thread :-) HTH Martin -----Ursprüngliche Nachricht----- Von: Shuaizhang Feng [mailto:fengsz@yahoo.com] Gesendet: Donnerstag, 9. April 2009 17:24 An: martin.weiss1@gmx.de Betreff: Re: st: RE: how to save output from TABLE or TABSTAT as a stata .dta data file Hi Martin: Thank you very much for your help. The -replace- option works fine for my purpose. -collapse- brings trouble to me as I am running the command mutliple times, generating multiple data sets with the intention to join them together at the end. But when some of the data set that -collapse- geneate is empty, it stops there. Even when I use -cpature- to force it, the data set still remains the orginal. I guess if I have "if .. else" control to first determine whether the dataset if empty, then maybe I can get rid of that problem. Shuaizhang --- On Wed, 4/8/09, Martin Weiss <martin.weiss1@gmx.de> wrote: > From: Martin Weiss <martin.weiss1@gmx.de> > Subject: Re: st: RE: how to save output from TABLE or TABSTAT as a stata .dta data file > To: statalist@hsphsun2.harvard.edu > Date: Wednesday, April 8, 2009, 6:13 PM > <> > > Of course, you could also specify the -replace- option with > -table- > > **** > sysuse auto, clear > table rep78, contents(sum headroom ) row replace > l > **** > > Also look at -ssc d tabout- > > > BTW, out of curiosity, how does -collapse- create trouble > when "some of the > data generated is empty"? > > > > HTH > Martin > _______________________ > ----- Original Message ----- > From: <fengsz@yahoo.com> > To: <statalist@hsphsun2.harvard.edu> > Sent: Wednesday, April 08, 2009 10:46 PM > Subject: Re: st: RE: how to save output from TABLE or > TABSTAT as a stata > .dta data file > > > > 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 <Albert.Lee@hud.gov> > wrote: > > > >> From: Lee, Albert <Albert.Lee@hud.gov> > >> Subject: st: RE: how to save output from TABLE or > TABSTAT as a stata .dta > >> data file > >> To: statalist@hsphsun2.harvard.edu > >> 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 > >> albert.lee@hud.gov > >> (202) 402 7562 > >> > >> > >> > >> -----Original Message----- > >> From: owner-statalist@hsphsun2.harvard.edu > >> [mailto:owner-statalist@hsphsun2.harvard.edu] > >> On Behalf Of Shuaizhang > >> Feng > >> Sent: Wednesday, April 08, 2009 2:51 PM > >> To: statalist@hsphsun2.harvard.edu > >> 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/ > > > > * > * 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/

- Prev by Date:
**RE: Re: st: What wrong with this ML model command?** - Next by Date:
**Re: st: adjusted Mann-Whitney/Wilcoxon test** - Previous by thread:
**st: adjusted Mann-Whitney/Wilcoxon test** - Next by thread:
**st: RE: AW: RE: AW: computing interaction effects after xtprobit** - Index(es):

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