Announcement

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

  • how to identify a mutual fund changes its name and when

    I have an unbalanced panel data about U.S. equity funds Variables:
    yrqt: a date variable, such as 1981q1, 1981q2…
    wficn: fund identifier
    fund_name: the name of a mutual fund

    Mutual fund may change its name over time. I want to create a new variable to identify these quarters when the fund’s name is different from the previous quarter. We can call this new variable is_change, whose value takes 1 if the fund’s name at current quarter is different from last quarter, and takes value of 0 if the fund’s name stays the same.

    How can I accomplish the task described above with stata codes? Any advice would be greatly appreciated. Thank you.
    Click image for larger version

Name:	4vx3F.png
Views:	1
Size:	14.9 KB
ID:	1478820

  • #2
    Check out the help for -dataex- and use -dataex- to provide a minimal data example.

    Otherwise this should not be difficult, something like this (pseudo code follows, I dont know the nature of your variables):

    sort fund_code date

    by fund_code: gen change = fund_name != fund_name[_n-1]

    by fund_code: replace change = 0 if _n==1


    And note that this treatment of the first period is a bit dodgy, because in the first period we do not know whether fund has changed name or not.
    Last edited by Joro Kolev; 14 Jan 2019, 19:02.

    Comment


    • #3
      You asked the same question earlier on Stack Overflow, and was also advised

      Please use dataex to give a data example we can use. (search dataex if necessary).

      Comment


      • #4
        Let me add to Joro's and Nick's advice some further advice that apparently has not been given to you yet, based on looking back at your earlier topics.

        To improve your presentation of problems on Statalist, you should take a few minutes to review the Statalist FAQ linked to from the top of the page, as well as from the Advice on Posting link on the page you used to create your post. Note especially sections 9-12 on how to best pose your question. It's particularly helpful to copy commands and output from your Stata Results window and paste them into your Statalist post using code delimiters [CODE] and [/CODE], and to use the dataex command to provide sample data, as described in section 12 of the FAQ.

        The more you help others understand your problem, the more likely others are to be able to help you solve your problem.

        Comment

        Working...
        X