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: Reshape help


From   Scott Merryman <scott.merryman@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Reshape help
Date   Fri, 21 May 2010 08:35:59 -0500

clear*
input str8 date str3 id str3 return
"1/1/2010" "XYZ" "10%"
"2/1/2010" "XYZ" "11%"
"1/1/2010" "ABC" "5%"
"2/1/2010" "ABC" "6%"
end

reshape wide return ,i(date) j(id) string
renpfix return
l

Scott

On Fri, May 21, 2010 at 8:25 AM, Joshua Shindell <jshindell@gmail.com> wrote:
>
> Dear Statalist,
>
> I have stock return data in the following format:
> Date       id     return
> 1/1/2010 XYZ 10%
> 2/1/2010 XYZ 11%
> 1/1/2010 ABC 5%
> 2/1/2010 ABC 6%
>
> I would like to get the data in the following format:
> date        XYZ    ABC
> 1/1/2010  10%    5%
> 2/1/2010  11%    6%
>
>
> I am having trouble using the -reshape- command to perform this
> rearrangement.  Many thanks for any help or suggestions.
>
> Best,
>
> Joshua A. Shindell

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