please help- nlces

I'm using stata 9.

I tried to use this code for nonlinear regression of a ces functiion and it just won't work :confused:
I also tried a few variations-
instead of varlist writing the variables.
adding and dropping version 9 etc.

I guess I'm just not proficient enough to understand what's wrong.

Help would be much appreciated

program nlces

syntax varlist(min=3 max=3) [aw fw iw] if, at(name)
local logout: word 1 of `varlist'
local capital: word 2 of `varlist'
local labor: word 3 of `varlist'

tempname b0 rho delta
scalar `b0' = `at'[1,1]
scalar `rho' = `at'[1,2]
scalar `delta' = `at'[1,3]

tempvar kterm lterm
generate double `kterm' = `delta'*`capital'^(-1*`rho') `if'
generate double `lterm' = (1-`delta')*`labor'^(-1*`rho') `if'

replace `logout' = `b0' - 1/`rho'*ln(`kterm'+`lterm') `if'


nl ces @ logout capital labor, parameters(b0 rho delta) initial(rho 1 delta 0.5)

Last edited: