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

From |
Sergiy Radyakin <serjradyakin@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: AW: st: Stata Inbuilt commands |

Date |
Thu, 8 Oct 2009 14:35:58 -0400 |

Dear Nick, a lot of the source code for Mata procedures is actually available and is shipped together with the ado files. I am not sure that this is the official Stata policy to keep the Mata code open (not the C code!) but my installation of Stata 11 contains 314 files with .mata extension which actually contain the code that was compiled into the Mata libraries. I believe the situation was the same with Stata 10, etc. They are an excellent source of examples of Mata capabilities as well as hints for hidden/not-described features. Victor: why would you want to see the code behind the -drop- command? Every language contains the BBBs (basic building blocks), which are considered to be indivisible. Consider the PRINT or INPUT statements in BASIC, or if { } else {} statement in C. You wouldn't really bother about their implementation (in machine code) unless you are concerned about: 1) performance - for example, I asked about the implementation of the -sort- command because I was concerned about its performance 2) compatibility/correctness - I asked about the implementation of the -file open- statement because I suspected it was not compatible with some extended Windows file open modes, I have shown some commands like -graph export- fail under some conditions and their implementation needs to be fixed. 3) reverse engineering/replication - I asked about the structure of the DTA datasets and particulars of the -save-/-use- commands because I wanted my software to be able to read/write Stata data files. Stata developers have always been very approachable with any well-motivated inquiries regarding the implementation and code behind any commands. Don't expect to get the C source code of -regress- though: this is with what the money is made. But if you have a specific point and you want to double check, that -regress- handles multicollinearity in a particular case correctly, I am sure you will be heard. However in many cases you just don't want to actually have the source code. I am almost sure it will be impossible to read it straight away, without knowing the whole structure and organization of the Stata program. Instead we are often interested in particular details, and it is easier to ask exactly about those details, rather than hunt for the source code. Best regards, Sergiy Radyakin On Thu, Oct 8, 2009 at 12:06 PM, Nick Cox <n.j.cox@durham.ac.uk> wrote: > Martin and Maarten [NB] have already explained that the code for inbuilt > functions and commands is not visible to users. Such inbuilt commands > are coded in C or Mata and the code compiled; the C or Mata source code > remains inaccessible and firmly within StataCorp. > > -invnorm()- and -uniform()- and their successors are cases in point. > There is nothing for such functions that users can see inside. > > What Victor may be thinking of here is -viewsource- or -source-: > > [P] viewsource . . . . . . . . . . . . . . . . . . . . . View > source code > (help viewsource) > > [M-1] source . . . . . . . . . . . . . . . . . . . Viewing the > source code > (help [M-1] source) > > Book . . . . . . . . . . . . . . . . . . . . . . . Thirty-three > Stata Tips > . . . . . . . . . . . . . . . . . . . . H. Joseph Newton and N. > J. Cox > http://www.stata.com/bookstore/tips.html > > SJ-6-1 pr0022 . . . . . . . . . . . Stata tip 30: May the source be > with you > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. > J. Cox > Q1/06 SJ 6(1):149--150 (no > commands) > tip for using viewsource to locate and view source > code or text files > > However, "source code" in the descriptions above is a strict subset of > the entire source code, i.e. ado files and uncompiled Mata code. To > repeat, the compiled source code is only visible through joining > StataCorp as a developer. > > Nick > n.j.cox@durham.ac.uk > > Victor M. Zammit > > Thank you very much,Martin and Mateen foryour help.I will take a look at > the sources that you have referred me to.However,some couple of years > ago,there was the same query and someone suggested some ado file that > reveals the code that is implied by functions such as > invnorm(uniform()).I know I had saved that suggestion,but since then the > computer that I was using had broken down and got lost. > Thank you before hand for any suggestions, > > > * > * 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/

**Follow-Ups**:**RE: AW: st: Stata Inbuilt commands***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**Re: AW: st: Stata Inbuilt commands***From:*Maarten buis <maartenbuis@yahoo.co.uk>

**References**:**Re: AW: st: Stata Inbuilt commands***From:*"vmz@vol.net.mt" <vmz@vol.net.mt>

**RE: AW: st: Stata Inbuilt commands***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

- Prev by Date:
**st: -syntax , option(varlist min=0)-?** - Next by Date:
**Re: st: matrix subsetting** - Previous by thread:
**RE: AW: st: Stata Inbuilt commands** - Next by thread:
**Re: AW: st: Stata Inbuilt commands** - Index(es):

© Copyright 1996–2014 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |