Announcement

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

  • Creating Change Variable "time variable not set" Error

    Hi everyone,

    I have panel data from Compustat, and I'm trying to calculate a variable called change in cash (chche), the variable cash is give by che.

    I tried doing

    gen chche = d.che

    And I'm getting the following error: "time variable not set"

    I probably need to run some other commands before generating that variable, but I'm not sure what and how to do it. Here's the link to my data file: https://drive.google.com/open?id=0B1...VR3QXBmU3lMNms

    Any help will be greatly appreciated. Thanks!

  • #2
    Indeed. This is basic stuff and you won't get far with such data without understanding it.

    Code:
    help tsset
    Introductions to [TS} and [XT} manuals

    https://www.youtube.com/watch?v=SOQvXICIRNY

    Comment


    • #3
      Originally posted by Nick Cox View Post
      Indeed. This is basic stuff and you won't get far with such data without understanding it.

      Code:
      help tsset
      Introductions to [TS} and [XT} manuals

      https://www.youtube.com/watch?v=SOQvXICIRNY
      Thanks Nick, I'll go over those manuals and give it a try.

      Comment


      • #4
        So basically, I need to create the change in cash for each firm. I can't just create a universal variable across my entire data, because there will be repeat dates.

        The videos and manuals are great, but they start with data that doesn't have repeat dates, so it's easy to define the time series when they're looking at one individual. Would I have to break my initial panel data set completely? That makes no sense, I'm looking at thousands of firms. There must be a way to create a "change in cash" variable that recognizes the firm identifier "gvkey" and creates a new column based on that. Or am I completely off?

        Thanks!

        Comment


        • #5
          This is what I've done. I've now been able to create a chche=d.che variable. Am I on the right track?

          Code:
          tsset gvk fyear, year
          panel variable: gvk (unbalanced)
          time variable: fyear, 1980 to 2012, but with gaps
          delta: 1 year

          Comment


          • #6
            The repeated dates are, it seems, just repeated for different firms. That's fine. You have some gaps, so correspondingly some of your change values will be missing. As always, change before the first value in any panel is also unknown, so missing too.

            Comment


            • #7
              hello and good day, I am so beginner in terms of Stata and econometrics, I want to use a lagged dependent variable in my model. which is the log of crime in the year 87, but when I generate the variable I receive an error "time variable not set".
              however, i read the previous commend but for me, it does not work. I become so happy to receive your guide. thank you so much in advance.
              my data is from 82 to 87, and I want to estimate in this term : reg lcrmrte unem llawexpc lcrmrt_1 if year==87 where lcrmrt_1 is the data of year 82, how can I generate lcrmrt_1?


              xtset crimes year
              panel variable: crimes (weakly balanced)
              time variable: year, 82 to 87
              delta: 1 unit
              Last edited by Khatereh Yarvesis; 04 Nov 2020, 13:20.

              Comment

              Working...
              X