Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

st: RE: nl @ within ado


From   Nick Cox <n.j.cox@durham.ac.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: nl @ within ado
Date   Mon, 25 Oct 2010 13:15:47 +0100

Conversely, why it is a problem that a separate file is needed? For example, packages based on -ml- are distributed as sets of files. 

Nick 
n.j.cox@durham.ac.uk 

Keith Dear

I am trying to build an ado file to fit a certain nonlinear model using
the function evaluator version of nl.
This requires defining a subsidiary program whose name must begin with
'nl'. So I wrote something like this:

======== mymodel.ado
prog mymodel
...
nl myfit @ y x, param(...) init(...)
...
end

prog nlmyfit
...
end
====================

This doesn't work because, being a subprogram of mymodel, the program
nlmyfit is actually named mymodel.nlmyfit, and so nl doesn't find it. If
I move the definition of nlmyfit to the calling do-file then the whole
thing works, but that defeats the purpose of writing an ado file at all.

Is there a way to define a program within an ado file but NOT have it
named as a subprogram?
(I tried putting nlmyfit in a separate file and running it from within
mymodel.ado, but Stata wasn't fooled.)
Or any other solution?

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index