I was looking for a command (or package) which will store a list of variables with value labels so I can refer to them later in a loop. Thanks.
-
Login or Register
- Log in with
*Identify and store a list of variables with ds ds, has(varlabel) foreach v of varlist `r(varlist)' { local vlab : variable label `v' di "The label for variable `v' is `vlab'" } *OR provide a varlist in your loop foreach v of varlist x1 x10-x15 { local vlab : variable label `v' di "The label for variable `v' is `vlab'" } *OR create a macro containing a list of variable names local vlist a b c d e f g h i j k foreach v of `vlist' { local vlab : variable label `v' di "The label for variable `v' is `vlab'" }
Comment