Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: reshaping


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: reshaping
Date   Thu, 25 Aug 2011 20:06:49 +0100

You're welcome. But such a wide-wide structure seems very un-Stataish.

I'll bet that whatever operations you want to do are not much more
difficult in your original structure with proper use of time-series
operators.

Nick

On Thu, Aug 25, 2011 at 7:56 PM, Abhimanyu Arora
<abhimanyu.arora1987@gmail.com> wrote:
> Thanks Nick, what a pleasingly ingenious solution!
>
> On Thu, Aug 25, 2011 at 7:43 PM, Nick Cox <njcoxstata@gmail.com> wrote:
>> On references to time of day, see
>> <http://www.stata.com/support/faqs/res/statalist.html#others> at "The
>> local is not global"
>>
>>  reshape wide value, i(country year) j(series) string
>>  rename valueE Exports
>>  rename valueG GDP
>>  rename valueI Imports
>>  reshape wide E G I , i(country) j(year) string
>>
>> Nick
>>
>>
>> On Thu, Aug 25, 2011 at 6:19 PM, Abhimanyu Arora
>> <abhimanyu.arora1987@gmail.com> wrote:
>>> Good evening statalist
>>>
>>> I have data in the following form with variable name row given by-
>>>
>>> series  country continent year2000 year2001 year2002
>>>
>>> GDP
>>> ...
>>>
>>> Exports
>>> ...
>>>
>>> Imports
>>> ....
>>>
>>> (series takes values such as GDP, Exports Imports etc)
>>>
>>> Since I would like to do some operations on GDP and Exports/Imports
>>> etc what I would ultimately like the variable name row to be is
>>>
>>> country continent GDP2000 Exports2000 Imports2000 GDP2000 Exports2001 and so on
>>>
>>> I managed to reshape as a first step to get
>>>
>>> series   country   continent  year  value
>>>
>>> But I need your suggestions to get to the form I desire.

*
*   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   |   Site index