Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: RE: defining program that is involved with stata and mata interaction
From
Nick Cox <[email protected]>
To
"'[email protected]'" <[email protected]>
Subject
st: RE: defining program that is involved with stata and mata interaction
Date
Fri, 8 Jul 2011 10:16:55 +0100
The problem report here is that "it can not get through", "can not work". That is no detail at all on what happens. Also, the program here is incomplete and we can not see your data, so we can't test it for ourselves. All in all, useful comment is made pretty difficult.
What I can see is that you are using different right quote characters. That won't work. Look at the different characters within
forvalue k=1/4{
replace u`k'=0 if u`k'==. &TR==0
}
regress e1 `basic' `T' `u', robust
My guess is that you are using word processing software to edit your code. Bad idea. Use a text editor and use left quote ` and right quote ' to indicate local macros.
Nick
[email protected]
Zhi Su
I write some commands
local basic "..."
gsort -TR
mvprobit (T1=`basic') (T2=`basic') (T3=`basic') (T4=`basic') if TR==1,robust
scalar O=e(N)
mvppred xbm if TR==1,xb
mata
N=3000
O=st_numscalar("O")
.
.
Y=st_data(k,("T1","T2","T3","T4"))
XBM=st_data(k,("xbm1", "xbm2", "xbm3","xbm4"))
.
.
st_store(k,("u1", "u2","u3","u4"),M_c)
end
forvalue k=1/4{
replace u`k'=0 if u`k'==. &TR==0
}
regress e1 `basic' `T' `u', robust
The program process run well when I run them directly.
Then I want to bootstrapp the whole process. Therefore, I
capture program drop NHreg
program define NHreg
local basic "..."
gsort -TR
mvprobit (T1=`basic') (T2=`basic') (T3=`basic') (T4=`basic') if TR==1,robust
scalar O=e(N)
mvppred xbm if TR==1,xb
mata
N=3000
O=st_numscalar("O")
.
.
Y=st_data(k,("T1","T2","T3","T4"))
XBM=st_data(k,("xbm1", "xbm2", "xbm3","xbm4"))
.
.
st_store(k,("u1", "u2","u3","u4"),M_c)
end
forvalue k=1/4{
replace u`k'=0 if u`k'==. &TR==0
}
regress e1 `basic' `T' `u', robust
end
I think the defined command "NHreg" will process all the whole progam.
Then I run command
NHreg
But the process can not go through at all.
Why the commands can not work through when I put them in "program
define NHreg" and use command "NHreg" to run them?
*
* 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/