Announcement

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

  • IMPORTANT QUESTION: Remove firms if fiscal year-end changes

    Goodmorning,

    For my thesis it is very important to remove all firms in my compustat database for which the fiscal year-end changes(to ensure the comparability of different years)
    I have no idea which command to use to reach this. Can someone help me with this?

    For example:
    GVKEY: 00104 Datadate: 31may2009 Fyear: 2008
    GVKEY 00104 Datadate: 31may 2010 Fyear: 2009
    GVKEY 00104 Datadte: 31June 2011: Fyear: 2010
    When this is the case the firm with GVKEY 00104 must be removed from my database, because of the change in Datadate.

    I hope someone can help me!

    Kind regards,
    Sjoerd

  • #2
    Don't do this: IMPORTANT QUESTION:

    You're implying that other people's questions are not important unless so flagged. Please don't go there.

    Apart from boggling at 31 June let's assume that your Datadate variable is a numeric variable with daily date display format.

    Code:
    gen enddate = string(day(Datadate)) + " " + string(month(Datadate))  
    
    bysort GVKEY (enddate) : gen bad = enddate[1] != enddate[_N] 
    
    drop if bad

    Comment


    • #3
      Thanks, i will have a look at this. I understand your point about IMPORTANT QUESTION. I just made an account and I am completely new here, won't do this again.

      Comment


      • #4
        Thanks Nick, it worked!

        Comment


        • #5
          Nick Cox There is some additional point to what I said in my first message. Only observations that have a fiscal-year-end change from t+1 to t or from t to t-1 have to be deleted. Do you have any idea how the code above would be like if this is applied? Thanks in advance!
          Last edited by Sjoerd Veldhuizen; 27 Apr 2021, 03:26.

          Comment


          • #6
            I don't understand #5 at all. Please follow https://www.statalist.org/forums/help#stata and post a data example sufficient to show what you have and what you want.

            Comment


            • #7
              Nick Cox Thanks for your reply! I tried to use dataex but unfortunately didn't quite work out, so that's why i added an image of my data underneath.

              This is my question: for my research it's is relevant that there are no fiscal years-end changes from year t(current year) to t-1(previous year) and from year t to year t+1(future year). For example: if from fyear 2011 to fyear 2019 the datadate changes to 31sept2011 instead of 31may2011, fyear 2011 is not comparable with fyear 2010. Therefore fyear 2010 and fyear 2011 have to be deleted from my dataset because each year must have a comparable datadate in year t-1 and in year t+1. If I use your code posted above all firm years are removed if there is a fiscal year-end change in the period fyear 2007 to fyear 2019. But for my analysis it is important to keep fyear 2007-2009 and 2012-2019 in my example, because for these years the data can be compared reliably.




              Kind Regards,
              Sjoerd

              Comment


              • #8
                Sorry, but the image is unreadable by me. Perhaps someone else dealing with your kind of data routinely can follow what you want.

                Comment


                • #9
                  Ok, I will look futher. Thanks!
                  Last edited by Sjoerd Veldhuizen; 01 May 2021, 03:25.

                  Comment


                  • #10
                    If interested, please follow the duplicate thread at https://www.statalist.org/forums/for...ar-end-changes

                    Comment

                    Working...
                    X