Statalist


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

Re: st: RE: reshape problem


From   "Anders Alexandersson" <andersalex@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: reshape problem
Date   Tue, 9 Dec 2008 12:27:03 -0500

Emanuele, does -isid regio- return an error? The -isid- command will
verify if you have wide data.

Anders Alexandersson
andersalex@gmail.com

Emanuele Millemaci <e.millemaci@gmail.com> wrote:
> Ada,
>
> I  tried two different ways to read in the data obtaining the same
> disappointing results: 1)I used the command "insheet"  2)  I copied
> from excel and pasted into the data editor. Data look rectangular and
> I cannot see missing values before typing the reshape command.
>
>
> 2008/12/9 Ada Ma <heu034@googlemail.com>:
>> Emanuele,
>>
>> Have you read in the data correctly?  If the data isn't read in
>> correctly then it may not form a proper rectangle, which explains why
>> it doesn't -reshape- properly.
>>
>> Ada
>>
>>
>> On Tue, Dec 9, 2008 at 1:41 PM, Martin Weiss <martin.weiss1@gmx.de> wrote:
>>> Sounds like a http://www.stata.com/statalist/archive/2005-11/msg01084.html
>>> problem... Where should the randomness come from in a command like
>>> -reshape-?
>>>
>>> HTH
>>> Martin
>>>
>>>
>>> -----Original Message-----
>>> From: owner-statalist@hsphsun2.harvard.edu
>>> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Emanuele
>>> Millemaci
>>> Sent: Tuesday, December 09, 2008 1:27 PM
>>> To: statalist@hsphsun2.harvard.edu
>>> Subject: st: reshape problem
>>>
>>> Hi,
>>>
>>> I had a dataset on excel with regions on the rows and years on the columns.
>>> I moved this data to Stata 10.1 MP(updated to the latest packages) and
>>> was trying to reshaping from wide to long as I would like to have all
>>> years' data of the same variable on the same column.
>>>
>>> Below, I report an example of what I have:
>>>
>>> regio prod1995 prod1996 .....prod2006
>>>
>>> 1         ....             ...            ...
>>> 2          ...             ...            ...
>>> 3         ...              ...            ...
>>> 4         ...             ...            ...
>>>
>>> I would like to get:
>>>
>>> regio years    prod
>>> 1      1995    ...
>>> 1      1996    ...
>>> ..
>>> 2      1995    ...
>>> ..
>>> 3      1995    ...
>>> ..
>>> 4      1995    ...
>>> ..
>>>
>>> The command I use is:
>>>
>>> reshape long prod, i(regio) j(year)
>>>
>>> It would appear a very easy task. Instead, the result I get is always
>>> different (every time I launch the command) and never correct.
>>> Stata drops many observations and many others become missing for some
>>> variable (whereas my dataset has no missing value). I have also
>>> checked that Stata considers data as numeric.
*
*   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/



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