Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Drop non-trading days

    Hello Statalist,

    I have queries about how to remove non-trading days. I use Stata v14.0. For simplicity, I use panel data, which have 10 firms for period 2006-2014. All data is in daily. I would like to create Return as a new variable using this command:

    gen return = ln(_price /lag_price)*100

    My question is, in order to generate return, should I use the ordinary calendar date or use the business calendar date? If I use the business calendar date, there are lots of missing value.

    After generated the return, I would like to drop the non-trading days. Here, the non-trading days defined as days on which 90% or more of the stocks listed have a return equal to zero. I have tried calculated manually but it is not an efficient way. Does anyone have ideas how to solve it?

    The last question is, I would like to drop a stock if the number of zero-return days is more than 80% in a given month. I have tried use this command:

    tab return if return ==0

    However, this is not what I want because it described in daily. How can I jumped from the daily return to the 80% in a month, let say zero-return stocks >80% in January, February and so on?

    I really need help from Statalist. Your help is highly appreciated.

    Regards,
    Rozita


    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float idc str21 company float caldate double(_marketvalue    _price    _returnindex)
    1 "ALUAR" 16803    4422 2.0100000000000002 6915.96
    1 "ALUAR" 16804  4395.6               1.99 6874.67
    1 "ALUAR" 16805  4461.6               2.02 6977.89
    1 "ALUAR" 16806  4474.8 2.0300000000000002 6998.54
    1 "ALUAR" 16807    4554               2.07 7122.41
    1 ""      16808       .                  .       .
    1 ""      16809       .                  .       .
    1 "ALUAR" 16810 4593.59               2.08 7184.34
    1 "ALUAR" 16811 4593.59               2.08 7184.34
    1 "ALUAR" 16812 4593.59               2.08 7184.34
    1 "ALUAR" 16813 4580.39               2.08  7163.7
    1 "ALUAR" 16814  4540.8               2.06 7101.76
    1 ""      16815       .                  .       .
    1 ""      16816       .                  .       .
    1 "ALUAR" 16817  4501.2               2.04 7039.83
    end
    format %td caldate

Working...
X