Statalist


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

Re: st: Updating user-supplied code / mca example


From   "Sergiy Radyakin" <[email protected]>
To   [email protected]
Subject   Re: st: Updating user-supplied code / mca example
Date   Tue, 7 Oct 2008 13:09:06 -0400

Here are some of my thoughts, Allan:

-Version- statement must be correctly handled within the .ado file of
a particular command, and the resulting program must be tested with
the earliest Stata version with which it is claimed to be compatible.
Unfortunately this is not always the case (testing like that is often
omitted, because only one version of Stata is typically installed).

version 1.0
zipfile test.zip test.dta

works fine in Stata 10, although the undocumented -zipfile- command
was only added in Stata 10.

Another common situation is:

//------ foo.ado -----
program foo
   version 6.0

   bar something
end

//------- bar.ado -----------
program bar
    version 6.0

    /* .... */
end

So if one command (foo) relies on another (bar) and bar get's updated
to say Stata 10, then foo will stop working on Stata 6 and also
require Stata 10. Thus relying on other's code is rather dangerous.

So far the only way to test it is to actually run it in Stata of a
particular version.

Things are even more complicated with Mata, since there is no way how
one can produce Mata 9.0 - compatible .mo-file in Stata 10 (according
to info from Stata Corp). One actually MUST compile in Stata 9 or
distribute the Mata code, which contradicts one of the declared
advantages of Mata (allowing to distribute Stata modules without
revealing the source code, although this is not a common practice in
the community).

IMHO, it would be desirable that Stata Corp allows using older
versions of Stata under the more recent licenses either generally or
solely for compatibility testing purposes (by the same user on the
same machine).

Also (IMHO) Version statement must be restricted to declare higher
values than current setting only from the command line, and never from
the .ado program.

Note also that some commands do not obey the version setting, like
save in Stata 10. An attempt to merge the dataset coming from Stata 10
with Stata 9 data in Stata 9 will crash Stata (while -use- will simply
issue an error message).



Best regards, Sergiy Radyakin




On Tue, Oct 7, 2008 at 5:45 AM, Allan Reese (Cefas)
<[email protected]> wrote:
> I found out recently that I've been misunderstanding the version command.  It's used in ADO files "to ensure your do-file will continue to work with different versions of Stata", and undoes changes to commands made in later versions.  But it doesn't prevent the use of commands added in later versions.
>
> The example to hand is that I'm using mca.ado:
> *! version 1.3.1 Philippe VAN KERM, February 1998  STB-42 sg78
> and wanted to update the graph plotting.  It was possible simply to change the graph command to "twoway scatter" leaving the program to run as "version 5".
>
> Philippe's code:
>                        while `n2'<=`d' {
>                               graph FDim`n2' FDim`n1', s([Flab]) /*
>                                  */ b1("Multiple Correspondence Analysis") /*
>                                  */ b2("Axis `n1'") l1(" ") /*
>                                  */ l2("Axis `n2'") xla yla xline(0) /*
>                                  */ yline(0)  border
>                                loc n2 = `n2' + 1
>
> becomes:
>                        while `n2'<=`d' {
>                                twoway scatter FDim`n2' FDim`n1', msym(i) mlab(Flab) mlabpos(c) /*
>                                  */ b1("Multiple Correspondence Analysis") /*
>                                  */ xti("Axis `n1'") yti("Axis `n2'") /*
>                                  */ xline(0) yline(0) `scatopt'
>                                loc n2 = `n2' + 1
>
> The new option scatopt is a string to allow any other twoway options to be passed through the command.  It is declared at the start of the program:
>
> Philippe:
> loc options "d(integer 0) q(real 0) Notrans"
> parse "`*'"
>
> becomes:
> * Option scatopt added Sept 2008. RAR.
> loc options "d(integer 0) q(real 0) Notrans scatopt(string)"
> parse "`*'"
>
> Incidentally, are there any other mca users, and any further developments of the code?
> Allan
>
> R Allan Reese
> Senior statistician, Cefas
> The Nothe, Weymouth DT4 8UB
>
> Tel: +44 (0)1305 206614
> Fax: +44 (0)1305 206601
>
> www.cefas.co.uk
>
>
>
>
>
>
> ***********************************************************************************
> This email and any attachments are intended for the named recipient only.  Its unauthorised use, distribution, disclosure, storage or copying is not permitted.  If you have received it in error, please destroy all copies and notify the sender.  In messages of a non-business nature, the views and opinions expressed are the author's own and do not necessarily reflect those of the organisation from which it is sent.  All emails may be subject to monitoring.
> ***********************************************************************************
>
>
> *
> *   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/
>
*
*   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