Announcement

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

  • specifying waves for xtlogit panel data regression

    Hi, I am trying to run a panel data regression for waves 4 and above from my dataset:

    xtset pidp UKHLSwave
    xtlogit lifesat unemployment outoflaborforce newduration newdursq10 married goodhealth age agesq10 loghhincome, if UKHLSwave >= 3

    but get the error message:

    if UKHLSwave >= 3 invalid
    r(198);

    I have recoded many of the variables prior to trying to execute this command (a lot of code so will not post here), but do not see how this could interfere with STATAs ability to identify the wave. I have checked and the UKHLSwave is identified by STATA as floating. What could be the issue here? And if there is an alternative way to run the regression for specified waves please do let me know!

  • #2
    Get rid of the comma that precedes your if qualifier and it will run the way you expect it to.*

    In Stata, commas are only used to separate the main part of a command from options, or to separate an option from its suboptions. The -if- and -in- (and, less commonly, -using-) clauses of commands are not options; they precede any comma.

    Added: *What I should have said is that this error message will go away. I can't guarantee that there aren't problems with your data, or that you haven't mistyped a variable name in your -xtlogit- command, or other things that will trigger new error messages.
    Last edited by Clyde Schechter; 08 May 2023, 18:18.

    Comment


    • #3
      Thank you for your quick response Clyde. I accidentally left the comma after trying the same command for a fixed effects regression. Unfortunately there is still a (different) error message. But, as a quick fix I have realised I can drop waves from the dataset to estimate a model only using specific waves - not the prettiest solution but seems to work for now.

      Comment

      Working...
      X