Hi all
Can someone advise me as to why the following piece of programme does
not work? I get the error message "__0000E8 already defined". The
programme worked fine until I began to use the tempname and tempvar
commands. I would greatly appreciate any ideas on where/why I have gone
wrong.
#delimit ;
tempvar diffqq2;
while `j' <= `depmax' { ;
local xless1 = `x'-1 ;
if `j' < `depmax' { ;
ge `diffqq2' = ( normprob(_b[_cut`x']-`scor_uqq') -
normprob(_b[_cut`x']-`scor_nqq') )
- ( normprob(_b[_cut`xless1']-`scor_uqq') -
normprob(_b[_cut`xless1']-`scor_nqq') )
if `1'~=. ;
} ;
else { ;
ge `diffqq2' = normprob(`scor_uqq'-_b[_cut`xless1']) -
normprob(`scor_nqq'-_b[_cut`xless1']) if `1'~=. ;
} ;
su `diffqq2' `if' ;
local diff`x' = r(mean) ;
scalar `check' = `check' + `diff`x'' ;
tempvar wj_1 phiwj_1 PHIwj_1;
rename `wj' `wj_1' ;
rename `phiwj' `phiwj_1' ;
rename `PHIwj' `PHIwj_1' ;
if `j'~=`depmax' { ;
ge `wj' = ( _b[_cut`x'] - `scoreqq' ) `if' ;
ge `phiwj' = (1/sqrt(2*_pi)) * exp( (`wj'^2)/-2 ) `if' ;
ge `PHIwj' = normprob(`wj') `if' ;
} ;
else { ;
ge `wj' = 0 ;
ge `phiwj' = 0 ;
ge `PHIwj' = 1 ;
} ;
replace `eqq'=( `phiwj_1' - `phiwj' ) / ( `PHIwj' - `PHIwj_1' ) if
`1'==`j' & `ifexp' ;
replace `e2qq'=( (`wj_1' * `phiwj_1') - (`wj' * `phiwj') )
/ ( `PHIwj' - `PHIwj_1' ) if `1'==`j' & `ifexp' ;
replace `e3qq'=( ((`wj_1'^2) * `phiwj_1') - ((`wj'^2) * `phiwj') )
/ ( `PHIwj' - `PHIwj_1' ) if `1'==`j' & `ifexp' ;
replace `e4qq'=( ((`wj_1'^3) * `phiwj_1') - ((`wj'^3) * `phiwj') )
/ ( `PHIwj' - `PHIwj_1' ) if `1'==`j' & `ifexp' ;
tempvar y`x'iqq y`xless1'iqq;
if `j'~=`depmax' { ;
capture drop `y`x'iqq' ;
if _rc == 0 { local dropvar="`dropvar' `y`x'iqq`" } ;
ge `y`x'iqq' = 0 `if' ;
replace `y`x'iqq'=( `phiwj' ) / ( `PHIwj' - `PHIwj_1' ) if `1'==`j' &
`ifexp' ;
} ;
if `x'~=2 { ;
replace `y`xless1'iqq'=( -1 * `phiwj_1' ) / ( `PHIwj' - `PHIwj_1' )
if `1'==`j' & `ifexp' ;
} ;
su `1' if `1'>`j' & `ifexp' ;
local j = r(min) ; /* replace j with next value of dep var */
local x=`x'+1 ;
drop `wj_1' `phiwj_1' `PHIwj_1' ;
} ;
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/