Dear Statalisters,
I need to do merge a file containing weekly data to a file containing monthly data (my Master Data set).
My Master Data set looks like this: (first column is the Date and second column is the unique identifier)
The Data set with the weekly data looks like this: (first column is the Date and second column is the unique identifier)
What I want Stata to do is to attach the weekly data to the monthly data and the number of observations of the first file to stay as it was.
The code I tried to apply is:
but it doesn't attaches the weekly data correctly to the monthly. Do you know how I can solve this issue?
Thanks in advance,
Angelos
I need to do merge a file containing weekly data to a file containing monthly data (my Master Data set).
My Master Data set looks like this: (first column is the Date and second column is the unique identifier)
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int Date str7 Sedol 14488 "2002587" 14518 "2002587" 14549 "2002587" 14579 "2002587" 14610 "2002587" 14641 "2002587" 14670 "2002587" 14701 "2002587" 14731 "2002587" 14762 "2002587" 14792 "2002587" 14823 "2002587" 14854 "2002587" 14884 "2002587" 14915 "2002587" 14945 "2002587" 14976 "2002587" 15007 "2002587" 15035 "2002587" 15066 "2002587" 15096 "2002587" 15127 "2002587" end format %tdnn/dd/CCYY Date
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int Date str7 Sedol 10927 "2002587" 10934 "2002587" 10941 "2002587" 10948 "2002587" 10955 "2002587" 10962 "2002587" 10969 "2002587" 10976 "2002587" 10983 "2002587" 10990 "2002587" 10997 "2002587" 11004 "2002587" 11011 "2002587" 11018 "2002587" 11025 "2002587" 11032 "2002587" 11039 "2002587" 11046 "2002587" 11053 "2002587" 11060 "2002587" 11067 "2002587" 11074 "2002587" end format %tdnn/dd/CCYY Date
The code I tried to apply is:
Code:
use firstfile, clear merge m:m Sedol Date using second file keep if _merge==1 drop _merge
Thanks in advance,
Angelos
Comment