Statalist


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

Re: st: RE: Stata version in user ados


From   Ben Jann <[email protected]>
To   [email protected]
Subject   Re: st: RE: Stata version in user ados
Date   Tue, 27 Jan 2009 01:04:04 +0100

> But anything with Mata is automatically 9 at least.

To keep a hybrid version of a command that uses Mata in Stata 9 or
newer but also works in Stata 8.2 (using a non-Mata variant of the
code) you could do something like:

---example.ado---
program define example
    version 8.2
    ...
    if c(stata_version)<9 {
        ...                  // Stata 8
    }
    else {
        mata: example_mata() // Stata 9 using Mata
    }
    ...
end

if c(stata_version)<9 exit

version 9.2
mata:

void example_mata()
{
    ...
}

end
---example.ado---

See, for example, -estwrite.ado- (ssc describe estwrite).

ben
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index