Bookmark and Share

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: RE: st : Calling a ML program in an ado file


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: st : Calling a ML program in an ado file
Date   Mon, 12 Jul 2010 14:06:32 +0100

The difference is that your program -toto- calls -titi-, which is in the same file as -toto-,  

whereas you want -ml- to call -myprobit-, which is not in the same file as -ml-. 

You do not want -Example- to call -myprobit-. 

-ml- does not know that it should look inside -Example-, which it was what you were asking. 

Nick 
[email protected] 

Valerie Orozco

Thank you Nick. It works!
But what's the difference between  a standard ado file?
For example, the following ado file is composed by 2 ado and it works (titi is known when called.)

/*----------------------------- begin toto.ado-----------------------------*/    
program toto
    version 11.1 
    
    di in red "toto is running"
    titi
      
end


program titi   
    version 11.1
    di "titi is in toto.ado"
end

exit
/*----------------------------- end toto.ado-----------------------------*/      

Thank you.

  "Nick Cox" <[email protected]>

Try putting your -myprobit- program in a separate file -myprobit.ado-. 

De : Valerie Orozco 

I would like to create some ado-files in order to replicate some estimations on several data.
I have some problems calling ml program in my ado (they are not known).

Let's take a small example : 

/*----------------------------- begin Example.ado-----------------------------*/
program Example
    version 11.1
    args varY X1 X2
    use http://www.stata-press.com/data/r11/auto
    
    di "Call myprobit"
    ml model lf myprobit (`varY' = `X1'  `X2')
    ml maximize
end

program myprobit
    version 11
    args lnf theta1
    quietly replace `lnf' = ln(normal(`theta1')) if $ML_y1==1
    quietly replace `lnf' = ln(normal(-`theta1')) if $ML_y1==0
end
/*----------------------------- end Example.ado-----------------------------*/

Running the ado "Example" gives the following message : 


. Example foreign mpg weight
(1978 Automobile Data)
Call myprobit
unrecognized command:   myprobit
r(199);"

I don't understand why the program "myprobit", written in the ado file, remains unknown...
What is my mistake???
Thanks a lot.

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


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index