program define cpyxplot
*! 1.1.0 NJC 15 January 1999
        version 5.0
        local tsize : set textsize
        parse "`*'", parse("\")
        if "`1'" == "\" | "`2'" != "\" | "`3'" == "" {
                di in r "incorrect syntax"
                exit 198
        }

        unabbrev `1', min(1)
        local yvars "$S_1"
        local ny : word count `yvars'
        mac shift 2

        local varlist "min(1)"
        local if "opt"
        local in "opt"
        local weight "aweight fweight iweight"
        local options /*
        */ "SAving(str) Margin(int 0) TItle(str) TEXTsize(int `tsize') *"
        parse "`*'"
        local nx : word count `varlist'

        tempvar touse
        mark `touse' `if' `in'

        set graphics off
        set textsize `textsize'
        local i = 1
        while `i' <= `ny' {
                local y`i' : word `i' of `yvars'
                local j = 1
                while `j' <= `nx' {
                        local x`j' : word `j' of `varlist'
                        tempfile y`i'x`j'
                        graph `y`i'' `x`j'' if `touse' [`weight' `exp'] /*
                         */ , saving(`y`i'x`j'') `options'
                        local files "`files' `y`i'x`j''"
                        local j = `j' + 1
                }
                local i = `i' + 1
        }
        set graphics on

        if "`saving'" != "" { local saving "sa(`saving')" }
        if "`title'" != "" { local title "ti(`title')" }
        graph using `files', `saving' margin(`margin') `title'
        set textsize `tsize'
end

/*

The syntax is

cpyxplot yvarlist \ xvarlist [if] [in] [weight] [, options]

After the first parse

`1'     should be     yvarlist
`2'     should be     \
`3'     should be     xvarlist [if] [in] [weight] [, options]

After mac shift 2

`1'    should be     xvarlist [if] [in] [weight] [, options]

and thereafter we have a standard parse.

*/