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]

st: Merge results in overwritten values unexpectedly


From   Matthew Watt <matthew.watt@msci.com>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: Merge results in overwritten values unexpectedly
Date   Tue, 3 Aug 2010 14:26:47 -0400

Hi,
I've run into a problem that I can't resolve and wanted to ask if others had the same problem (or if I've simply made a mistake).

I have two datasets that I am trying to merge.

Dataset 1:  Company information, with foreign exchange ("fx") rates that update quarterly, per month (variable name:  "quarterly_eur_rate").  Ie:  The fx rate for Jan 31 is the same as Feb 28 and Mar 31 (forward-filled).

Dataset 2:  Euro fx rates that update per month (variable name:  "EUR_RATE")

Dates are forced to be the end of month in both datasets.

I'm using the following command with my company information dataset loaded:


merge m:1 obsDate curcd using fxRates.dta, keep(match)


Where curcd is the name of the currency (ie:  "EUR", "JPY", "USD", ...)

I expected, and Stata returned, an additional column, EUR_RATE, with monthly observations.  What I didn't expect was that the quarterly fx rate would be changed to the monthly value (the variables have different names).  This happens regardless of the name I assign to my quarterly fx rate (ie:  "temp"), and if I create a copy of the quarterly fx rate, it too is overwritten.

What I need:  The original quarterly fx rates and the merged monthly fx rates.  Given these two things, I can compute the currency-adjusted values of the other variables in my dataset.

Anyone know why Stata is overwriting data?  The fx rates that are updated quarterly will, for about 1/3 of the observations, be the same as those updated monthly--could this cause Stata to burp?

Thanks for any comments,
Matt Watt
Research Group
MSCI Inc


This email message and any attachments are for the sole use of the intended recipients and may contain proprietary and/or confidential information which may be privileged or otherwise protected from disclosure. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not an intended recipient, please contact the sender by reply email and destroy the original message and any copies of the message as well as any attachments to the original message.

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