Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: Reshaping dataset


From   Andrea Molinari <[email protected]>
To   statalist <[email protected]>
Subject   Re: st: Reshaping dataset
Date   Sat, 27 Apr 2013 10:32:45 -0300

Hi!
Thanks, I think that did the trick!
Cheers,
Andrea

On 26 April 2013 13:41, Christopher Zbrozek <[email protected]> wrote:
> Hi Andrea,
>
> If I'm understanding the problem correctly, the same type of
> information is in cadena, cadenacompartida1, and cadenacompartida2 in
> a wide format. You want to reshape to a long format where the info
> from all three of those variables is in a single variable, cadena,
> correct?
>
> In that case, you could rename the variables to cadena1, cadena2, and
> cadena3 and reshape long, and Stata will understand that the values
> from all three of those variables should go in a single variable,
> cadena, in the long dataset, and your by groups should form correctly.
> (The same process would also apply to the subcadena variables, of
> course.)
>
> Hope that helps,
> Christopher Zbrozek
> University of Michigan
>
> On Fri, Apr 26, 2013 at 12:24 PM, Andrea Molinari <[email protected]> wrote:
>> Dear statalisters,
>>
>> I´m working with a dataset which groups many dimensions and I´m having
>> a little trouble reshaping the data for the (rather basic)
>> calculations I need to do.
>>
>> The dataset has the following columns:
>>
>> year flow partner value cadena usoecon subcadena cadenacompartida1
>> subcadenacompartida1 cadenacompartida2 subcadenacompartida2
>>
>> In order to regroup the data summing "value" by year, flow, cadena
>> subcadena and usoecon, I need that:
>>
>> - the values in cadenacompartida1 and cadenacompartida2 go under those
>> in the column "cadena"
>>
>> - the values in subcadenacompartida1 and "subcadenacompartida2"   go
>> under those in the column "subcadena"
>>
>> To do so, I tried several options with -reshape long-, but I don´t
>> seem to get the right reshaping to get the data in the way I need to
>> then calculate:
>>
>> bysort year flow cadena subcadena usoecon: egen double svalue=sum(value)
>>
>> Any ideas of those handling large datasets would be more than welcomed!
>>
>> Cheers,
>> Andrea
>>
>> --
>> Andrea Molinari, PhD
>> Investigadora Asistente
>> Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
>> Instituto Interdisciplinario de Economía Política de Buenos Aires (IIEP- BAIRES)
>> Córdoba 2122, 2do. piso (http://iiep-baires.econ.uba.ar)
>> Tel: +54 11 4374-4448, int. 6362
>>
>> *
>> *   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/



-- 
Andrea Molinari, PhD
Investigadora Asistente
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
Instituto Interdisciplinario de Economía Política de Buenos Aires (IIEP- BAIRES)
Córdoba 2122, 2do. piso (http://iiep-baires.econ.uba.ar)
Tel: +54 11 4374-4448, int. 6362

*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index