I don't understand what extra point Ben is making here.
When one program working under version 10 calls another
without a -version- statement, then that other is working
under 10, and -index()- isn't recognised.
This is the point with which the thread started.
Nick
[email protected]
Ben Jann
> Richard writes:
> > If every little subroutine needs its own version command, the docs
> > should be clear on that. But if I recall correctly, the advice has
> > always been to put version at the top of the main program.
> I suppose
> > putting version commands in the subroutines may be a good idea if,
> > say, part of the code is being updated for Stata 10 but you don't
> > want to bother making sure that all the other code also still works
> > correctly in Stata 10.
>
> The version statement is NOT needed in the subroutines. Example:
>
> /*-------------------------------------*/
> . program thetest9
> 1. version 9
> 2. _thetest
> 3. end
>
> . program thetest10
> 1. version 10
> 2. _thetest
> 3. end
>
> . program _thetest
> 1. local pos = index("abc","c")
> 2. di as res "`pos'"
> 3. end
>
> . thetest9
> 3
>
> . thetest10
> Unknown function index()
> r(133);
> /*-------------------------------------*/
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/