nulldata 50 set seed 547 series x = 100 * uniform() # open a "progressive" loop, to be repeated 100 times loop 100 --progressive series u = 10 * normal() # construct the dependent variable series y = 10*x + u # run OLS regression ols y const x # grab the coefficient estimates and R-squared scalar a = $coeff(const) scalar b = $coeff(x) scalar r2 = $rsq # arrange for printing of stats on these print a b r2 # and save the coefficients to file store coeffs.gdt a b endloop