Announcement

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

  • Running two way fixed effect

    I have created a panel data set with 25 variables and 2500 observations. I was trying to use this command : xtset district year, but STATA shows an error message: "string variables not allowed in varlist; district is a string variable". How can I solve this problem?

    ** I have attached a screenshot of the data. TIA.
    Attached Files

  • #2
    Code:
    encode district, gen(n_district)
    xtset n_district year
    In the future, when showing data examples, please use the -dataex- command to do so. If you are running version 15.1 or a fully updated version 14.2, -dataex- is already part of your official Stata installation. If not, run -ssc install dataex- to get it. Either way, run -help dataex- to read the simple instructions for using it. -dataex- will save you time; it is easier and quicker than typing out tables. It includes complete information about aspects of the data that are often critical to answering your question but cannot be seen from tabular displays or screenshots. (Screenshots are particularly unhelpful because even when they are readable, which they often are not, it is not possible to import the data from a screenshot into Stata to work with it if needed.) It also makes it possible for those who want to help you to create a faithful representation of your example to try out their code, which in turn makes it more likely that their answer will actually work in your data.



    When asking for help with code, always show example data. When showing example data, always use -dataex-.

    Comment


    • #3
      thank you sir.

      Comment

      Working...
      X