program define lstack
*! NJC 1.0.0 6 November 1998
* wrapper for -stack- that labels _stack with variable names
* one output variable only!
* requested by David Leblang
        version 5.0
        local varlist "req ex min(2)"
        local if "opt"
        local in "opt"
        local options "Into(string) *"
        parse "`*'"
        parse "`varlist'", parse(" ")

        if "`into'" != "" {
                local ninto : word count `into'
                if `ninto' > 1 {
                        di in r "one -into- variable only"
                        exit 198
                }
                local into "into(`into')"
        }

        local nvars : word count `varlist'
        local i 1
        while `i' <= `nvars' {
                local labels "`labels' `i' ``i''"
                local i = `i' + 1
        }

        stack `varlist' `if' `in', `options' `into'
        label def _stack `labels'
        label val _stack _stack
end