Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: New user...trying to use ADO file with SVR

From   Roger Newson <>
Subject   Re: st: New user...trying to use ADO file with SVR
Date   Tue, 19 Aug 2003 17:41:24 +0100

At 09:05 19/08/03 -0700, kat jackson wrote:
I am a beginner STATA user/programmer and have run
into problems when trying to use an ado file.

I want to use an ado file to work with -svrest-,
however I'm running into problems when it gets to the
ado file trying to run.

I've been submitting the -svrset- part first.  I then
try to submit the line
svrest "ml_try2", mat(e(b))
and here is where I run into problems.

Below you will find the code in my ado file.
---------  begin ml_try2.ado  ----------------
 program define mlcot
  version 8.1
  args lnf B0 B1 B2 sigma
  tempvar res
  quietly gen double `res' = logcot -
  quietly replace `lnf'=-0.5*ln(2*_pi) -ln(`sigma')
 ml model lf mlcot (B0:) (B1:) (B2:) (sigma:), robust
 ml search
 ml maximize
---------  end ml_try2.ado  -----------------

I get the following error:
  unrecognized command:  mlcot
  program mlcot not found
  error when command executed on original dataset
  invalid syntax

I don't know if there is something w/my ado file or
not.  I do want to point out that when I run the
program above by itself, I have no problems & get
results.  So I don't believe that there's anything
wrong with the coding to run the -ml- model.
Stata expects an ado-file to contain a program of the same name, ie the ado-file -ml_try2.ado- should contain a program -ml_try2-, and -mlcot.ado- should contain a program -ml_cot-. I think what Kat really wants to do is to use -ml_try2.ado- as a do-file instead of an ado-file. To do this, rename -ml_try2.ado- to, and then run by typing

do ml_try2

In this case, Stata will run, and will find the program -ml_cot- inside, and execute -ml_cot- when told to do so by -ml-.

The suffix -ado- is short for Automatic DO, and implies that the file contains a program of the same name. See -help do- and -help ado- for more information.

I hope this helps.

Best wishes


Roger Newson
Lecturer in Medical Statistics
Department of Public Health Sciences
King's College London
5th Floor, Capital House
42 Weston Street
London SE1 3QD
United Kingdom

Tel: 020 7848 6648 International +44 20 7848 6648
Fax: 020 7848 6620 International +44 20 7848 6620
or 020 7848 6605 International +44 20 7848 6605

Opinions expressed are those of the author, not the institution.

* For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index