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]

Re: Re: st: [Working with MLIB files] Issues with Stata Compiler and earlier Stata versions


From   George Vega Yon <[email protected]>
To   [email protected], [email protected]
Subject   Re: Re: st: [Working with MLIB files] Issues with Stata Compiler and earlier Stata versions
Date   Fri, 22 Mar 2013 11:14:09 -0300

Dear Nick,

Thanks for your help. I've just got older versions of Stata in order
to build mata libraries which work with older versions of Stata.

Worked for me.

Thanks!

Date: Mon, 18 Mar 2013 20:58:28 +0000
From: Nick Cox <[email protected]>
Subject: Re: st: [Working with MLIB files] Issues with Stata Compiler
and earlier Stata versions

You have to compile those Mata functions under 12.0 or earlier to get
round this, assuming that's possible. (Details of your code may
prevent it.)

There were important changes to Mata in 12.1, important enough to
change the compiler.

I don't know what "generic" means here, but that will make no difference.

- -version- is not a time machine that reverses important changes, so it
can't help here. See also

http://www.stata.com/support/faqs/programming/user-written-programs-and-stata-version/

My personal habit is always to distribute source Mata code, as I like
to be able to look at others' Mata code and imagine that to be
reciprocated,
but nothing makes that compulsory. Some people prefer to keep some or
all of their code quiet. StataCorp has good reasons to do that, and no
doubt others have too.

Nick

On Mon, Mar 18, 2013 at 8:42 PM, George Vega Yon <[email protected]> wrote:

> I have the following problem: I'm writing a Stata module which uses
> several MATA functions (routines) some of them generic, which is why
> I've choose to distribuit it through .mlib files. The thing is that,
> after building the .milb file using Stata 12.1 (where the module
> works), trying it out in Stata 12.0 returns the following error:
>
> . cnu_afili 65
> (mt_cnu_2_1() in lcnu, compiled by Stata 12.1, is too new to be run by
> this version of Stata and so was ignored)
>                  <istmt>:  3499  mt_cnu_2_1() not found
> r(3499);
>
> At first I thought that "versioning" the functions would help, but
> after adding "version 9.0" at the begining of all the mata functions,
> Stata 12.0 keeps returning the same error. A example of a function is:
>
> --------------------------------------------------------------------------------
> real colvector mt_mejoramiento_tabla(
>         real colvector qx,        // Valor Qx (Mortalidad)
>         real colvector aa,        // Valor AA (Factor de mejoramiento)
>         real scalar agno_qx,      // Agno de la tabla
>         real scalar agno_actual,  // Agno de calculo
>         real scalar edad          // Edad del individuo
>         )
>         {
>
>         version 9.0
>
>         real scalar difagnos
>
>         difagnos = agno_actual - agno_qx
>
>         return(qx :* (1 :- aa):^(difagnos :+ (1::rows(qx)) :- edad :-1))
> }
>
> ...
>
> mata mlib create lcnu, replace
> mata mlib add lcnu *()
> --------------------------------------------------------------------------------
>
> Am I doing something wrong here? If everything is Ok, what suggestions
> do you have? I'm hoping to share this through SSC

George Vega Yon
7 647 2552
http://cl.linkedin.com/in/georgevegayon
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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