clear
pause on
program drop _all

program define mysim
			  if "`1'"=="?" {
                    global S_1 "max_x min_x "
                    exit
            }
            drop _all
          	set obs 500
		gen x = invnorm(uniform()) + 2
		gen y = -.3 + .8*x + invnorm(uniform())
		summarize x
		post `1' (r(max)) (r(min))
    end

simul mysim, rep(500)
gen y1 = -.3 + .8*max_x + invnorm(uniform())
gen y2 = -.3 + .8*min_x + invnorm(uniform())