sysuse auto,clear //遍历显示所有变量名 foreach v of varlist _all { dis "`v'" } //显示当前记录各个变量的值 foreach v of varlist _all { dis `v' } //ds显示所有变量名,只有变量名 ds foreach v of varlist `r(varlist)' { dis "`v'" }