Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Tempname and Tempvar - help desperately needed


From   [email protected]
To   [email protected]
Subject   st: RE: Tempname and Tempvar - help desperately needed
Date   Wed, 19 Jun 2002 11:08:23 -0400

Miss M Paul or Anna-Lisa Pierre (see archive June 07, st:tempvar).
Re-posting under a different email address is not going to get you much help
in trying to solve your problem.  Numerous users have replied asking you to
-set trace on- and send the log to the list or to look at the contents of
the macros (via -mac list-) prior to the line where your program fails.
You never did bother.  That's your prerogative but enough with the re-posts.

Pat Joly

-----Original Message-----
From: Miss M Paul [mailto:[email protected]]
Sent: June 19, 2002 10:27 AM
To: [email protected]
Subject: st: Tempname and Tempvar - help desperately needed


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/
*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index