Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Estrella Gomez <estrellastata@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: Balanced panel |
Date | Thu, 11 Jul 2013 16:09:49 +0200 |
Perfect! Thanks a lot Estrella 2013/7/11 Nick Cox <njcoxstata@gmail.com>: > Check out -fillin-. > > [D] fillin . . . . . . . . . . . . . . . . . . . . Rectangularize dataset > (help fillin) > > SJ-5-1 dm0011 . . . . . . . . . . . . . . Stata tip 17: Filling in the gaps > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox > Q1/05 SJ 5(1):135--136 (no commands) > tips for using fillin to fill in gaps in a rectangular > data structure > Nick > njcoxstata@gmail.com > > > On 11 July 2013 14:47, Estrella Gomez <estrellastata@gmail.com> wrote: >> Dear statalisters >> >> I have a panel that contains exporters, importers and years. Since >> some countries do not trade at all, I would like to generate the zero >> observations for those cases. The command tsfill, full allows me to do >> it for a pair of countries that traded in a given year, but no in the >> rest. It generates zero observations for the years in which two >> countries did not trade, given that those countries traded in some >> year of the sample. >> >> However, I would also like to generate zero flows if two countries did >> not trade at all in any year. For instance, in the following case: >> >> t exporter importer trade >> 2006 AR CA 1 >> 2008 AR CA 1 >> 2006 US CA 1 >> 2007 US CA 1 >> 2008 US CA 1 >> 2006 US AR 1 >> 2007 US AR 1 >> 2008 US AR 1 >> 2006 CA US 1 >> 2007 CA US 1 >> 2008 CA US 1 >> 2006 AT US 1 >> 2007 AT US 1 >> 2008 AT US 1 >> >> tsfill, full would generate: >> >> t exporter importer trade >> 2007 AR CA . >> >> but I would also need >> >> t exporter importer trade >> 2006 AR AT . >> 2007 AR AT . >> 2008 AR AT . >> >> >> Any idea? >> Thank you very much, >> Estrella >> * >> * For searches and help try: >> * http://www.stata.com/help.cgi?search >> * http://www.stata.com/support/faqs/resources/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/faqs/resources/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/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/