Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Nick Cox <n.j.cox@durham.ac.uk> |

To |
"'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu> |

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 n.j.cox@durham.ac.uk 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/

**Follow-Ups**:**st: RE: RE: defining program that is involved with stata and mata interaction***From:*Nick Cox <n.j.cox@durham.ac.uk>

**References**:**st: defining program that is involved with stata and mata interaction***From:*Zhi Su <su.zh@husky.neu.edu>

- Prev by Date:
**st: RE: Estout Error With Factor Variables** - Next by Date:
**st: RE: RE: defining program that is involved with stata and mata interaction** - Previous by thread:
**st: defining program that is involved with stata and mata interaction** - Next by thread:
**st: RE: RE: defining program that is involved with stata and mata interaction** - Index(es):