Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

Re: st: somersd error message

From   "Roger B. Newson" <>
Subject   Re: st: somersd error message
Date   Wed, 31 Oct 2012 11:08:14 +0000

Yes, as Maarten says, that is essentially the problem, and it is one that I am commonly asked about privately. My standard answer is given below.

Best wishes



I think the solution here is to exit Stata after downloading -
somersd-, and then to launch Stata again, and then to try to use
-somersd- (or -cendif- or -censlope-).

The reason that this usually works is that -somersd- contains
a Mata library, containing several Mata programs such as -
tidottree()-. Stata usually has a path of Mata libraries,
which it searches for Mata programs. If you type, in Stata,

. mata: mata query

then Stata will give some output similar to:

   Mata settings
       set matastrict      off
       set matalnum        off
       set mataoptimize    on
       set matafavor       space      may be space or speed
       set matacache       400        kilobytes
set matalibs lmatabase;lmataado;lmataopt;lmatasem;lmoremata;lmoremata10;lsomersd;ltt;l_cfrmt
       set matamofirst     off

This strange output gives the Mata settings, which include -set
matalibs-, which gives the path of Mata libraries searched. In
this case, this path includes -lsomersd.milb-, the Mata library
installed with the -somersd- package.

However, in some versions of Stata, if you install -somersd-,
then the -set matalibs- path is not immediately updated to
include - lsomersd.mlib-. In these versions of Stata, if you
exit and then re-launch, then Stata builds the new -set
matalibs- path at launch time, by searching its ado-file path
for -.mlib- files. At that point, Stata will find -
lsomersd.mlib- and ad it to the path.

I hope this helps. Let me know if you have any more queries.


Roger B Newson BSc MSc DPhil
Lecturer in Medical Statistics
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute
Imperial College London
Royal Brompton Campus
Room 33, Emmanuel Kaye Building
1B Manresa Road
London SW3 6LR
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Web page:
Departmental Web page:

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

On 31/10/2012 11:01, Maarten Buis wrote:
--- On Wed, Oct 31, 2012 at 11:37 AM, Barry Quinn wrote:
I am using Stata12 on a Mac and have recently used -ssc install- to install the above package.

i am continually get the following error when running the command

tidotforsomersd():  3499  tidottree() not found
                  <istmt>:     -  function returned error

my Stata12 is updated to the latest version and i have used the auto.dta example from the help file which also produces the above error.

I suspect that the problem is that -somersd- uses a pre-compiled Mata
function library. In order for Mata (and thus Stata ( and thus
-somersd-)) to use it, it first needs to add it to its index. However,
this does not happen automatically after you install a program with
-ssc-. The reason is that that would also clear the Mata (not Stata)
memory, which would be very un-stataish behavior for a Stata program
like -ssc-, though probably unproblematic in most cases. As soon as
you restart Stata, Stata will automatically index the necessary Mata
functions and -somersd- should run. Alternatively, you don't have to
restart Stata if you type -mata:mata mlib index-. Anyhow, if this is
the problem than this issue only bites in the Stata session in which
you installed -somersd-.

-- Maarten

Maarten L. Buis
Reichpietschufer 50
10785 Berlin
*   For searches and help try:

*   For searches and help try:

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