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 at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: Suggestion for Reshape


From   Anders Alexandersson <andersalex@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Suggestion for Reshape
Date   Fri, 17 Sep 2010 09:44:57 -0400

Elena, the first step is to get the information from Excel into Stata,
see http://www.stata.com/support/faqs/data/newexcel.html.

Then, I would do a reshape long followed by a reshape wide, see
http://www.stata.com/support/faqs/data/reshape3.html.
That is I would go from long countyid*x (8*5 rows), to long-long
countyid*x*yr (8*5*9 rows), to long countyid*yr (8*9 rows).

Anders
andersalex@gmail.com

On Fri, Sep 17, 2010 at 5:28 AM, Elena Quercioli
<elena.liquorice@gmail.com> wrote:
> My data is organized in an Excel source file as I explain here, below:
>
>
> SOURCE EXCEL FILE
>
>                     yr_1      yr_2       yr_3   ...      yr_9
>
> County_1    x1_11   x1_12    x1_13   ...  x1_19
>                     x2_11   x2_12    x2_13   ...  x2_19
>           .   .   .    ...  .
>                     x5_11   x5_12  x5_13   ...  x5_19
> County_2     x1_21   x1_22  x1_23   ...  x1_29
>                     x2_21   x2_22  x2_23   ...  x2_29
>                    .   .   .    ...  .
>                     x5_21  x5_22  x5_23   ...  x5_29
> .
> .
> .
> County_8  (same 5X9 matrix but for County 8)
>
> where x1_{ij} will eventually be the independent variable in a fixed
> effects (panel) regression
>
> the DESIRED "LONG" STATA FORM is
>
> countyid  yr  x1  x2  x3  x4  x5
>
> with  7  columns  and  9*8 rows.
>
> I cannot figure out how to use the "reshape" command to get to my
> desired Stata form. Can someone please assist me with this?

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