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: Merging Time-Invariant Characteristics Into A Panel Dataset


From   Rebecca Pope <[email protected]>
To   [email protected]
Subject   Re: st: Merging Time-Invariant Characteristics Into A Panel Dataset
Date   Fri, 29 Mar 2013 09:42:18 -0500

Hi Nick,
This is fairly straightforward. You need to think of your problem just
in terms of the number of observations. You have many observations on
each fund in one dataset and one observation per fund in the other. I
suggest that you read -help merge- to find out more. With respect to
the specific example that you've shown, Stata requires that the
variables you merge on have the same name. So, since you are going to
merge using your fund ID, you need to first -rename- one of the
variables (either FundID to fund or vice versa).

Regards,
Rebecca

On Fri, Mar 29, 2013 at 8:40 AM, Nick Baker <[email protected]> wrote:
> Hi all,
>
> I have data for many mutual funds giving returns in different time periods
> in a stata dataset that looks like follows:
>
> FundID  Date    ret(t-1)        ret(t-2)
> 1       2006m1  .       .
> 1       2006m2  -12.38985       .
> 1       2006m3  -8.219995       -12.38985
> 1       2006m4  5.497518        -8.219995
> 1       2006m5  -0.9465399      5.497518
> 1       2006m6  2.219898        -0.9465399
> 2       2006m1  .       .
> 2       2006m2  10.39785        .
> 2       2006m3  9.54027 10.39785
> 2       2006m4  -5.947091       9.54027
> 2       2006m5  -2.846269       -5.947091
> 2       2006m6  -12.51931       -2.846269
>
>
> In a second dataset I have time-invariant characteristics that apply to each
> fund in every time period:
>
> fund    mgmtfee perffee  strategy
> 1       1.75    20      EM
> 2       2       20      EM
>
> I want to find a way to merge these two datasets so that the time-invariant
> characteristics appear in each observation such as:
>
> FundID  Date    ret(t-1)        ret(t-2)        mgmtfee perffee strategy
> 1       2006m1  .       .                       1.75    20      EM
> 1       2006m2  -12.38985       .               1.75    20      EM
> 1       2006m3  -8.219995       -12.38985       1.75    20      EM
> 1       2006m4  5.497518        -8.219995       1.75    20      EM
> 1       2006m5  -0.9465399      5.497518        1.75    20      EM
> 1       2006m6  2.219898        -0.9465399      1.75    20      EM
> 2       2006m1  .       .                       2       20      EM
> 2       2006m2  10.39785        .               2       20      EM
> 2       2006m3  9.54027 10.39785                2       20      EM
> 2       2006m4  -5.947091       9.54027         2       20      EM
> 2       2006m5  -2.846269       -5.947091       2       20      EM
> 2       2006m6  -12.51931       -2.846269       2       20      EM
>
>
> I think this should be possible using the merge command, but I am not sure
> how to work it.
>
> Thannks for you help,
>
> Nick Baker
>
> *
> *   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/


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