Quite so. Indeed, knowing that -xtsum- is implemented as an .ado file
(strictly, not a .do file) means that 
viewsource xtsum.ado 
will give you a view of the code, without (a) needing
to doing a -which- to find out precisely where the 
file is, or (b) any risk of modifying the code. 
This tip is explained in more detail in 
SJ-6-1  pr0022  . . . . . . . . . . . Stata tip 30: May the source be with you
        Q1/06   SJ 6(1):149--150                                 (no commands)
        tip for using viewsource to locate and view source
        code or text files
and in "Thirty-three Stata Tips" from StataCorp. 
Nick 
[email protected] 
Neil Shephard
 
> On 7/6/06, Podest�, Federico <[email protected]> wrote:
> 
> > I have (I think) a simple problem: I would like to know 
> formulas used by the -xtsum- command to obtain the betweem 
> standard deviation and the within standard deviation.
> > In particular I would like to know Stata code to compute 
> such statistics by hand solving all parts of the formulas 
> step by step.
> 
> The formulas for the methods implemented in Stata (at least those I've
> ever had recourse to look up) are given in the manuals, in this
> instance it will be [XT].
> 
> In this instance because -xtsum- is implemented as a do-file....
> 
> . which xtsum
> /usr/local/stata9/ado/base/x/xtsum.ado
> *! version 1.0.9  06aug2004
> 
> ..you can look at the code yourself by viewing the relevant file in a
> text-editor.
> 
> (Be wary of modifying the file which will break things.  If you want
> to make modifications, don't, instead clone the do-file to your
> personal-ado file and rename it, and make modifications to that).
*
*   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/