*! _gdsetcheck2 0.2.1 2008-01-27
*   > minor cleanup

//  check if gdset has been run and necessary variables are set.
//  return r(error) with error codes if grvar gr1let and gr0let are not set.

capture program drop _gdsetcheck2

program define _gdsetcheck2, rclass
    version 9

//  CHECK IF GLOBALS ARE DEFINED

    local error = 0
    foreach g in gvar g1var g0var {
        if "$`g'"=="" {
            local error = 1
            di in red "\$`g' is not defined."
        }
    }
    if `error' {
        di in red "You need to run gdset."
    }

    return local error = `error'

end
exit

//  History

* _gdsetcheck1 0.1.0 2007-03-11
* _gdsetcheck1 0.1.1 2007-03-14
* _gdsetcheck2 0.2.0 2007-03-22