Announcement

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

  • Local define range of columns

    Hi everyone,

    I am trying to select a range of columns for a foreach loop but am unsuccessful!

    I would like to select all colunms from 8 to 62 OR from column named "d_oc77mean" up until column named "mo50_oc81m"

    So far, I have my code is:
    . local i=8/62
    . display `i'


    OR


    . local valist = "d_oc77mean - mo50_oc81m"
    . display `valist'



    Neither of the codes above work though ... Could anyone please help?

    Many thanks!

  • #2
    Marcela, if your final purpose is to use a foreach loop, then you may directly write the list of variables in the code, as below.

    Code:
    foreach v of varlist d_oc77mean-mo50_oc81m {
        ...
    }

    Comment


    • #3
      Code:
      foreach susanoo of var d_oc77mean-mo50_oc81m {
      cls
      su `susanoo'
      }

      Comment

      Working...
      X