Announcement

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

  • Stata is returning error on 4x2 2 factorial ANOVA



    anova dist Brand ##Club
    Brand: string variables may not be used as factor variables






    Click image for larger version

Name:	Screenshot (1008).png
Views:	1
Size:	129.7 KB
ID:	1735441

  • #2
    The message is self-explanatory: the variables used in -anova- have to be numeric. Both Brand and Club are string variables, so not allowed.

    You have to change them to numeric variables with value labels:

    Code:
    foreach v of varlist Brand Club {
        encode `v', gen(_`v')
        order _`v', after(`v')
        drop `v'
        rename _`v' `v'
    }
    des Brand Club
    
    anova dist Brand##Club
    In the future, when showing data examples, please use the -dataex- command to do so. If you are running version 18, 17, 16 or a fully updated version 15.1 or 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. 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.

    Comment


    • #3
      thanks a lot and thanks for the tip

      Comment

      Working...
      X