Announcement

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

  • Regression with 150 variables

    Hi,

    I want to run a simple regression but I have 150 variables and I do not want to type all of them in the code or click on them from list of variables. Is there a faster way to do this without having to type or click all of them? Thank you.

    Best Regards,


  • #2
    If they are just 150 arbitrary variable names, then the only way to do this is if they are located consecutively as a block in the data set. In that case
    Code:
    regress dep_var indvar1-indvar150
    will do it.

    But I'm guessing your data set does not have them all lined up next to each other like that. The next hope is that there is something systematic about their names. For example if the variables are things like xyz1 xyz2 xyz3 abc55 abc56 abc57 abc58, then
    Code:
    regress dep_var xyz* zbc*
    will do it (provided that you want to use all variables whose names begin with xyz or abc.)

    If there is no systematic pattern to the names, and if they are not consecutive, then there is no short way to do it.

    Do read -help varlist- for more information about "wildcards" that enable you to address groups of variables with similar names.

    Comment


    • #3
      Thank you so much! It worked.

      Comment

      Working...
      X