--- Nick Cox <[email protected]> wrote:
> *! NJC 1.0.0 16 Oct 2003
> program tabstatmat
> version 8
>
> args matout garbage
> if "`matout'" == "" | "`garbage'" != "" error 198
>
> if "`r(name1)'" == "" {
> di as err "nothing found"
> exit 498
> }
>
> // how many vectors?
> local I = 1
> while "`r(name`I')'" != "" {
> local ++I
> }
> local --I
>
> // build up matrix
> if rowsof(r(Stat1)) == 1 {
> forval i = 1/`I' {
> local vectors "`vectors' r(Stat`i') \"
> local names "`names' `r(name`i')'"
> }
> matrix `matout' = `vectors' r(StatTot)
> }
> else {
> forval i = 1/`I' {
> local vectors "`vectors' (r(Stat`i'))' \"
> local names "`names' `r(name`i')'"
> }
> matrix `matout' = `vectors' (r(StatTot))'
> }
>
> matrix rownames `matout' = `names' Total
> matrix list `matout'
> end
Nick,
Thank you for the program. Could you please explain the difference
between the -if- and -else- loops? Why does the "vectors" part change
(by the way, the quotes don't match in the -else- loop), but not the
"names" part?
Friedrich Huebler
__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com
*
* 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/