Announcement

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

  • Generate a d

    Hello,

    I want to generate a first-time and seasoned green-bond-issuer variable, following the specifications of Flammer (2021), "Corporate Green Bonds"(https://doi.org/10.1016/j.jfineco.2021.01.010).
    For this, I have a panel of bonds (id) and date (tid) with the respective issuer id and the dummy variable is ESG. The tricky part is to generate a variable conditioned on id_issuer for different ids, since an issuer often has several bonds issued at the same time.

    The first time-issuer variable should be a dummy variable that equals 1 if the bond issued is esg (=1) and is the first one. The seasoned variable is a dummy variable, that equals 1 if the issuer has other green bonds issued at the same time (tid), even if the bond is not esg (=0).

    My data looks like this:
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input int(id id_issuer) byte isesg int tid
    1 11 0  23
    1 11 0  24
    1 11 0  25
    1 11 0  26
    2 14 0  15
    2 14 0  16
    2 14 0  17
    2 14 0  18
    2 14 0  19
    2 14 0  20
    2 14 0  21
    2 14 0  22
    2 14 0  23
    2 14 0  24
    2 14 0  25
    2 14 0  26
    2 14 0  27
    2 14 0  28
    2 14 0  29
    2 14 0  30
    2 14 0  31
    2 14 0  32
    2 14 0  33
    2 14 0  34
    2 14 0  35
    2 14 0  36
    2 14 0  37
    2 14 0  38
    2 14 0  39
    3 14 1 30
    3 14 1 31
    3 14 1 32
    3 14 1 33
    3 14 1 34
    3 14 1 35
    3 14 1 36
    3 14 1 37
    3 14 1 38
    3 14 1 39
    3 14 1 30
    3 14 1 31
    3 14 1 32
    3 14 1 33
    3 14 1 34
    3 14 1 35
    3 14 1 36
    3 14 1 37
    3 14 1 38
    3 14 1 39
    The data shows 3 bonds (ids= 1, 2, and 3) from two issuers (id_issuer =11, and 14). Issuer 14 becomes first-time issuer and seasoned at time (tid=30). After the maturity date of bond 3, the id_issuer is not longer a first time issuer, but the seasoned variable remains 1 if they are other green bonds issued at that time. Any clues of how to deal with it? Thank you

  • #2
    The first time-issuer variable should be a dummy variable that equals 1 if the bond issued is esg (=1) and is the first one.
    Code:
    by id_issuer (tid id), sort: gen byte first_timer = sum(isesg)
    by id_issuer (tid id): replace first_timer = (first_timer == 1 & first_timer[_n-1] == 0)
    Note: Although it doesn't arise in the example data, if there is a situation where the same issuer issues two green bonds on the same date, having never issued green bonds before, the one with the lowest numerical value of id will be designated as the first by this code. If you have some other preferred way to break ties like this, the code would have to be modified to reflect that.

    The seasoned variable is a dummy variable, that equals 1 if the issuer has other green bonds issued at the same time (tid), even if the bond is not esg (=0). ... After the maturity date of bond 3, the id_issuer is not longer a first time issuer, but the seasoned variable remains 1 if they are other green bonds issued at that time.
    I have no idea what this is supposed to mean, and, in any case, there is no variable in the example data that represents maturity date.
    Last edited by Clyde Schechter; 13 Dec 2021, 11:58.

    Comment


    • #3
      Clyde Schechter, Thank you for the help. The syntax for the double-grouped variables was what I needed.

      It have coded the seasoned variable following your approach. To simplify the definition, seasoned equals 1 if the issuer has one (or more ESG) bonds at that time or has previously issued one. I assume that a bond has matured if it is not longer on the data.

      Code:
      bys id_issuer (tid id), sort : gen byte esg_issuer= sum(isesg)
      
      bys id_issuer (tid id), sort : gen first_timer = (esg_issuer ==1 & esg_issuer[_n-1]==0)
      
      gen seasoned=0
      bys id_issuer (tid id), sort :  replace  seasoned = 1 if esg_issuer==1 |  first_timer[_n-1]==1
      PS: I should have double checked the title of the post. It should read : Generating first-time and seasoned ESG issuers by ids and date.

      Comment

      Working...
      X