Hi all, I am hoping someone can help me. I am trying to simulate data with autocorrelation. When I enter the program name regLDV STATA returns an error "invalid name"

global nobs = 200
global nmc = 1000
set seed 10101
set obs $nobs
gen time = _n
tsset time

scalar theta = .8 /*autocorrelation in x */
scalar beta = 10 /* slope for x */
scalar sigma = 20 /*variance of y */
scalar delta = .5 /*coeff for lagged y */
scalar rho = .8 /*auto correlation in errors */

gen x = rnormal()
replace x = theta*L.x + rnormal() in 2/$nobs
gen u = 0
gen y = 0

program regLDV, rclass
tempname sim
postfile 'sim' b1 b2 se1 se2 using results, replace
quietly {
forvalues i = 1/$nmc {
*generate errors and samples of y
replace u = rho.L.u + rnormal(0,sigma) in 2/$nobs
replace y = beta*x+delta*L.y + u in 2/$nobs
*run the regression
reg y x /*b1 OLS, w/o LDV */
*save the estimated slopes and its std error of b
scalar b1 = _b[x]
scalar se1 = _se[x]
*repeat for other
post 'sim' (b1) (b2) (se1) (se2)
}
}
postclose 'sim'
end

regLDV
use results, clear
summarize

Thanks
Kate