Thanks Eva! You are so nice and patient.
After correcting all the typo you mentioned, the codes for the example works.
However, in my own program, there's r(111) even correcting all the
similar typo. I am not sure if r(11) is still a kind of error that
caused by typo or other big errors. If it's caused by typo, I will
check it again and agian until it works. What I am worried about is
that it's the codes designing errors.
My codes is:
program nlsurweb
version 10.1
syntax varlist(min=16 max=16) [if], at(name)
tokenize `varlist'
args lnc sl sk sm lnpl lnpk lnpm lnpe lnq t d1 d2 d3 d4 d5 d6
tempname al ak am ae
scalar `al'=`at'[1,1]
scalar `ak'=`at'[1,2]
scalar `am'=`at'[1,3]
scalar `ae'=1-`al'-`ak'-`am'
tempname aq aqq
scalar `aq'=`at'[1,4]
scalar `aqq'=at'[1,5]
tempname blq bkq bmq beq
scalar `blq'=`at'[1,6]
scalar `bkq'=`at'[1,7]
scalar `bmq'=`at'[1,8]
scalar `beq'=-`blq'-`bkq'-`bmq'
tempname bqt bq1 bq2 bq3 bq4 bq5 bq6
scalar `bqt'=`at'[1,9]
scalar `bq1'=`at'[1,10]
scalar `bq2'=`at'[1,11]
scalar `bq3'=`at'[1,12]
scalar `bq4'=`at'[1,13]
scalar `bq5'=`at'[1,14]
scalar `bq6'=`at'[1,15]
tempname at att blt bkt bmt bet
scalar `ai'=`at'[1,16]
scalar `aii'=`at'[1,17]
scalar `blt'=`at'[1,18]
scalar `bkt'=`at'[1,19]
scalar `bmt'=`at'[1,20]
scalar `bet'=-`blt'-`bkt'-`bmt'
tempname ad1 ad2 ad3 ad4 ad5 ad6 bt1 bt2 bt3 bt4 bt5 bt6
scalar `ad1'=`at'[1,21]
scalar `ad2'=`at'[1,22]
scalar `ad3'=`at'[1,23]
scalar `ad4'=`at'[1,24]
scalar `ad5'=`at'[1,25]
scalar `ad6'=`at'[1,26]
scalar `bt1'=`at'[1,27]
scalar `bt2'=`at'[1,28]
scalar `bt3'=`at'[1,29]
scalar `bt4'=`at'[1,30]
scalar `bt5'=`at'[1,31]
scalar `bt6'=`at'[1,32]
tempname bl1 bl2 bl3 bl4 bl5 bl6 bk1 bk2 bk3 bk4 bk5 bk6 bm1
bm2 bm3 bm4 bm5 bm6 be1 be2 be3 be4 be5 be6
scalar `bl1'=`at'[1,33]
scalar `bl2'=`at'[1,34]
scalar `bl3'=`at'[1,35]
scalar `bl4'=`at'[1,36]
scalar `bl5'=`at'[1,37]
scalar `bl6'=`at'[1,38]
scalar `bk1'=`at'[1,39]
scalar `bk2'=`at'[1,40]
scalar `bk3'=`at'[1,41]
scalar `bk4'=`at'[1,42]
scalar `bk5'=`at'[1,43]
scalar `bk6'=`at'[1,44]
scalar `bm1'=`at'[1,45]
scalar `bm2'=`at'[1,46]
scalar `bm3'=`at'[1,47]
scalar `bm4'=`at'[1,48]
scalar `bm5'=`at'[1,49]
scalar `bm6'=`at'[1,50]
scalar `be1'=`at'[1,51]
scalar `be2'=`at'[1,52]
scalar `be3'=`at'[1,53]
scalar `be4'=`at'[1,54]
scalar `be5'=`at'[1,55]
scalar
`be6'=-`bl1'-`bl2'-`bl3'-`bl4'-`bl5'-`bl6'-`bm1'-`bm2'-`bm3'-`bm4'-`bm5'-`bm6'-`bk1'-`bk2'-`bk3'-`bk4'-`bk5'-`bk6'-`be1'-`be2'-`be3'-`be4'-`be5'
tempname dll dkl dkk dml dmk dmm
scalar `dll'=`at'[1,56]
scalar `dkl'=`at'[1,57]
scalar `dkk'=`at'[1,58]
scalar `dml'=`at'[1,59]
scalar `dmk'=`at'[1,60]
scalar `dmm'=`at'[1,61]
quietly {
replace lnc =
5+`aq'*`lnq'+`al'*`lnpl'+`ak'*`lnpk'+`am'*`lnpm'+(1-`al'-`ak'-`am')*`lnpe'+`blq'*`lnpl'*`lnq'+`bkq'*`lnpk'*`lnq'+`bmq'*`lnpm'*`lnq'+(-`blq'-`bkq'-`bmq')*`lnpe'*`lnq'+`aqq'*0.5*`lnq'*`lnq'+`ay'*`t'+`att'*0.5*`t'*`t'+`blt'*`lnpl'*`t'+`bkt'*`lnpk'*`t'+`bmt'*`lnpm'*`t'+(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ml'+`al'*`am')*`lnpl'*`lnpe'+(-`dkl'*`dkl'-`dkk'*`dkk'+`ak'-`ak'*`ak')*0.5*`lnpk'*`lnpk'+(-`dkl'*`dml'-`dkk'*`dmk'-`ak'*`am')*`lnpk'*`lnpm'+(`dll'*`dkl'+`al'*`ak'+`dkl'*`dkl'+`dkk'*`dkk'-`ak'+`ak'*`ak'+`dkl'*`dml'+`dkk'*`dmk'+`ak'*`am')*`lnpk'*`lnpe'+(-`dml'*`dml'-`dmk'*`dmk'-`dmm'*`dmm'+`am'-`am'*`am')*0.5*`lnpm'*`lnpm'+(`dll'*`dml'+`al'*`am'+`dkl'*`dml'+`dkk'*`dmk'+`ak'*`am'+`dml'*`dml'+`dmk'*`dmk'+`dmm'*`dmm'-`am'+`am'*`am')*`lnpm'*`lnpe'+(-`dll'*`dll'+`al'-`al'*`al'-`dll'*`dkl'-`al'*`ak'-`dll'*`dml'-`al'*`am'-`dll'*`dml'-`al'*`am'-`dkl'*`dml'-`dkk'*`dmk'-`ak'*`am'-`dml'*`dml'-`dmk'*`dmk'-`dmm'*`dmm'+`am'-`am'*`am'-`dll'*`dkl'-`al'*`ak'-`dkl'*`dkl'-`dkk!
'*`dkk'+`
ak'-`ak'*`ak'-`dkl'*`dml'-`dkk'*`dmk'-`ak'*`am')*0.5*`lnpe'*`lnpe'
replace sl =
`al'+`blq'*`lnq'+(-`dll'+`al'-`al'*`al')*`lnpl'+(-`dll'*`dkl'-`al'*`ak')*`lnpk'+(-`dll'*`dml'-`al'*`am')*`lnpm'+(`dll'-`al'+`al'*`al'+`dll'*`dkl'+`al'*`ak'+`dll'*`dml'+`al'*`am')*`lnpe'+`blt'*`t'+`bl1'*`d1'+`bl2'*`d2'+`bl3'*`d3'+`bl4'*`d4'+`bl5'*`d5'+`bl6'*`d6'
replace sk =
`ak'+`bkq'*`lnq'+(-`dll'*`dkl'-`al'*`ak')*`lnpl'+(-`dkl'*`dkl'-`dkk'*`dkk'+`ak'-`ak'*`ak')*`lnpk'+(-`dkl'*`dml'-`dkk'*`dmk'-`ak'*`am')*`lnpm'+(`dll'*`dkl'+`al'*`ak'+`dkl'*`dkl'+`dkk'*`dkk'-`ak'+`ak'*`ak'+`dkl'*`dml'+`dkk'*`dmk'+`ak'*`am')*`lnpe'+`bkt'*`t'+`bk1'*`d1'+`bk2'*`d2'+`bk3'*`d3'+`bk4'*`d4'+`bk5'*`d5'+`bk6'*`d6'
replace sm =
`am'+`bmq'*`lnq'+(-`dll'*`dml'-`al'*`am')*`lnpl'+(-`dkl'*`dml'-`dkk'*`dmk'-`ak'*`am')*`lnpk'+(-`dml'*`dml'-`dmk'*`dmk'-`dmm'*`dmm'+`am'-`am'*`am')*`lnpm'+(`dll'*`dml'+`al'*`am'+`dkl'*`dml'+`dkk'*`dmk'+`ak'*`am'+`dml'*`dml'+`dmk'*`dmk'+`dmm'*`dmm'-`am'+`am'*`am')*`lnpe'+`bmt'*`t'+`bm1'*`d1'+`bm2'*`d2'+`bm3'*`d3'+`bm4'*`d4'+`bm5'*`d5'+`bm6'*`d6'
}
end
nlsur web @ lnc sl sk sm lnpl lnpk lnpm lnpe lnq t d1 d2 d3 d4 d5 d6,
parameters(al ak am aq aqq blq bkq bmq bqt bq1 bq2 bq3 bq4 bq5 bq6 ai
aii blt bkt bmt ad1 ad2 ad3 ad4 ad5 ad6 bt1 bt2 bt3 bt4 bt5 bt6 bl1
bl2 bl3 bl4 bl5 bl6 bk1 bk2 bk3 bk4 bk5 bk6 bm1 bm2 bm3 bm4 bm5 bm6
be1 be2 be3 be4 be5 dll dkl dkk dml dmk dmm) neq(4) ifgnls
Quoting Eva Poen <[email protected]>:
This message that I sent earlier has not made it through to the list;
I therefore re-send it. My apologies, should it appear twice.
Eva
***************************
Jingjing,
Also, take a look at the following line:
> sca1ar `g4l'=`g14'
You want `g41' here, not `g4l' (i.e. the number 1 instead of the
letter l, as in life). With the commands -scalar- and -forvalues- it's the
other way round (you have the number 1 in those commands where
you should have the letter l). See also -help scalar-
and -help forvalues-.
Oh, and I just noticed that your line
> replace `w3' =
`a3'+`g31'*`lnp1'+`g32*`lnp2'+`g33'*`lnp3'+`g34'*`lnp4'+`b3'*(`lnm'-`lnpindex')
still lacks a closing single quote after `g32. You want:
replace `w3' =
`a3'+`g31'*`lnp1'+`g32'*`lnp2'+`g33'*`lnp3'+`g34'*`lnp4'+`b3'*(`lnm'-`lnpindex')
Eva
2009/3/15 Kit Baum <[email protected]>:
<>
The word is s c a L a r. Eva pointed that out quite clearly.
Kit Baum | Boston College Economics and DIW Berlin |
http://ideas.repec.org/e/pba1.html
An Introduction to Stata Programming |
http://www.stata-press.com/books/isp.html
An Introduction to Modern Econometrics Using Stata |
http://www.stata-press.com/books/imeus.html
On Mar 15, 2009, at 02:33 , Jingjing wrote:
sca1ar `a2'=`at'[1,2]
sca1ar `a3'=`at'[1,3]
sca1ar `a4'= 1-`a1'-`a2'-`a3'
tempname b1 b2 b3
sca1ar `b1'=`at'[1,4]
sca1ar `b2'=`at'[1,5]
sca1ar `b3'=`at'[1,6]
etc.
*
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/