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]

st: Merging Time-Invariant Characteristics Into A Panel Dataset


From   Nick Baker <nb419@cam.ac.uk>
To   statalist@hsphsun2.harvard.edu
Subject   st: Merging Time-Invariant Characteristics Into A Panel Dataset
Date   29 Mar 2013 13:40:39 +0000

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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index