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

st: Re: HOW to select data with specific criterions from another data set

From   Kit Baum <[email protected]>
To   [email protected]
Subject   st: Re: HOW to select data with specific criterions from another data set
Date   Sun, 20 Sep 2009 07:14:22 -0400

You don't say what 'with no success' means. For this to work you must ensure that the ticker and date values are the same datatype in each dataset. Particularly, make sure that the dates are Stata dates: integers (as you have daily data) with %td format.

Using the old Stata 10 syntax,

use divdata
sort ticker date
save divdata, replace
use quotedata, clear
sort ticker date
merge ticker date using divdata, unique
tab _merge

This should result in _merge being 3 for the tickers and dates for which you have dividend payments. _merge==1 is fine, that just means that the stock traded on many days when a dividend was not paid. You should not get any _merge==2 as that would be ticker-date combinations for which you do not have trade information, which should not happen.

If the merge fails, it is probably because the datatypes of your merge key variables (ticker and date) are not the same, or their contents are not consistent in the two datasets (a common problem with firm data).


On Sep 20, 2009, at 2:33 AM, amatoallah wrote:

I'm confronted to a problem, I' have a database of  daily cotations
per enterprises, and another data set that gives the dividends
distributed   per enterprises and per dates
I'want to have for each entreprise and per date the daily cotation and
the dividend, I've tried the command merge but with  no success, what
I' want is very similar with the  job of the excel function vlookup
but this time with two criterions : Enterprise(ticker) and date.
Someone has an idea???

Kit Baum   |   Boston College Economics & DIW Berlin   |
An Introduction to Stata Programming |
   An Introduction to Modern Econometrics Using Stata  |

*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index