Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Merge results in overwritten values unexpectedly

From   Matthew Watt <>
To   "" <>
Subject   st: Merge results in overwritten values unexpectedly
Date   Tue, 3 Aug 2010 14:26:47 -0400

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

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:

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