Announcement

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

  • Selecting the first variable without knowing it's name

    Hello all,

    I'm doing some big data cleaning for a lot of excel files, and I'm trying to figure out how can I get stata to select the first variable without me specifying it's "variable name", so that I can loop it.

    Is there a way to do this?

  • #2
    One way

    Code:
    sysuse auto , clear
    unab varlist : * 
    gettoken varname1 : varlist
    di "`varname1'"
    and another, using Mata

    Code:
    sysuse auto , clear
    mata : st_local("varname1", st_varname(1))
    display "`varname1'"
    Best
    Daniel

    Comment

    Working...
    X