Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Nick Cox <njcoxstata@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: reshape |
Date | Tue, 11 Oct 2011 13:22:14 +0100 |
Try i(country indicator) Nick On Tue, Oct 11, 2011 at 1:18 PM, Abu Camara <abucamara@gmail.com> wrote: > I am trying to reshape from wide to long using the following command > but I get the error as reported below . > /**reshape long yr, i(country) j(year) **/ > I know country is not unique because indicator has 4 levels and > country is repeated. Any help would be appreciated. Thanks in advance. > > > **--error message---------- > reshape long yr, i(country) j(year) > (note: j = 2004 2005 2006 2007 2008 2009 2010) > i=country does not uniquely identify the observations; > there are multiple observations with the same value of country. > Type "reshape error" for a listing of the problem observations. > > > > **---------------------sample data-----------------------------------. > country indicator yr2004 yr2005 yr2006 yr2007 yr2008 yr2009 yr2010 > Albania 4 3.60E+09 4.00E+09 4.50E+09 5.50E+09 6.70E+09 6.00E+09 6.00E+09 > Albania 1 1.50E+09 1.60E+09 1.70E+09 2.00E+09 2.20E+09 2.10E+09 2.00E+09 > Albania 3 1.80E+09 2.10E+09 2.00E+09 2.00E+09 > Albania 2 1.40E+09 1.50E+09 1.60E+09 1.80E+09 2.10E+09 2.00E+09 2.00E+09 > Algeria 2 4.40E+10 5.90E+10 6.90E+10 7.80E+10 1.00E+11 6.60E+10 > Algeria 4 2.60E+10 2.90E+10 3.30E+10 3.90E+10 5.00E+10 4.10E+10 > Algeria 1 8.00E+09 7.90E+09 8.80E+09 1.00E+10 1.10E+10 1.40E+10 > Algeria 3 5.10E+09 5.70E+09 6.10E+09 6.70E+09 7.50E+09 7.30E+09 > Azerbaijan 4 2.70E+09 3.20E+09 4.70E+09 7.60E+09 1.00E+10 1.20E+10 1.30E+10 > Azerbaijan 1 9.50E+08 1.20E+09 1.50E+09 2.20E+09 2.70E+09 3.10E+09 3.40E+09 > Bahrain 4 > Bahrain 1 > Bangladesh 3 8.80E+09 9.60E+09 1.00E+10 1.20E+10 1.40E+10 1.50E+10 1.70E+10 > Bangladesh 2 1.40E+10 1.60E+10 1.70E+10 1.90E+10 2.20E+10 2.50E+10 2.80E+10 > Benin 2 5.40E+08 5.80E+08 > Benin 3 3.10E+08 3.20E+08 > * * 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/