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

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

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

Subject |
RE: st: RE: collapse panel data for each year |

Date |
Fri, 28 May 2004 17:29:11 +0100 |

Should work once you take the comma out of -group()-. But the intermediate step of creating an extra variable, while it does no harm, is unnecessary. Nick n.j.cox@durham.ac.uk > -----Original Message----- > From: owner-statalist@hsphsun2.harvard.edu > [mailto:owner-statalist@hsphsun2.harvard.edu]On Behalf Of Thomas > Trikalinos (.Mac) > Sent: 28 May 2004 17:22 > To: statalist@hsphsun2.harvard.edu > Subject: Re: st: RE: collapse panel data for each year > > > Would this be better? > > . egen tralala = group(country, year) > . collapse x y , by(tralala) > > > On May 28, 2004, at 19:14, sarah smith wrote: > > > Hi Nick, > > If I use collapse as below: > > > > collapse x y, by(country) > > > > It is not useful for me since I need to run collapse for the data > > portions in each of the 20 years. > > Best, > > Sarah > > > > > > > >> From: "Nick Cox" <n.j.cox@durham.ac.uk> > >> Reply-To: statalist@hsphsun2.harvard.edu > >> To: <statalist@hsphsun2.harvard.edu> > >> Subject: st: RE: collapse panel data for each year > >> Date: Fri, 28 May 2004 16:53:46 +0100 > >> > >> Once you've -collapse-d the data once, you > >> have a new dataset, so I can't see that > >> you'd want to do this in a loop. > >> > >> At first glance you just need to include > >> the variable for country in the -by()- option. > >> > >> Nick > >> n.j.cox@durham.ac.uk > >> > >> sarah smith > >> > > >> > I have panel data for several industries in 40 countries for > >> > 20 years. For > >> > each year, I am trying to collapse the data by country. I > >> > tried to use > >> > foreach and forvalues commands, but could not work it > out. I would > >> > appreciate if you can help me. > >> > >> * > >> * 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/ > > > > _________________________________________________________________ > > FREE pop-up blocking with the new MSN Toolbar – get it now! > > http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/ > > > > * > > * 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/ > * * 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/

- Prev by Date:
**st: RE: convert stata7 to stata8 graph** - Next by Date:
**st: condition global assignment on value of local variable?** - Previous by thread:
**RE: st: RE: collapse panel data for each year** - Next by thread:
**RE: st: RE: collapse panel data for each year** - Index(es):

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