Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Displaying a matrix title [was tab-delimited output of tabodds]


From   "Ben Jann" <ben.jann@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Displaying a matrix title [was tab-delimited output of tabodds]
Date   Thu, 27 Mar 2008 11:37:48 +0100

-mat2txt- also has a -title()- option. So type

mat2txt, matrix(m3) saving(tabodds) append title("`val'")

ben

On Thu, Mar 27, 2008 at 8:06 AM, Herve STOLOWY <stolowy@hec.fr> wrote:
> Dear Statalisters:
>
>  Following your postings to my question on tabodds (and I thank Svend and Margaret), I found a solution based on a mixture of what you suggested and matrices. This solution works and I provide below the command lines.
>
>  I now have a basic question on the matrix title. I run a loop with three countries. I would like to have the name of the country displayed as the title of each matrix. I read the Stata help and found a partial solution to my problem: matrix list m3, title("`val'") . The title is displayed on the screen within the loop. However, I don't get it in the final matrix which is exported to a tab-delimited file through -mat2txt- (downloadable from ssc).
>
>  Is there a way to solve this (little) problem?
>
>  Best regards
>
>  Herve Stolowy
>
>  capture erase tabodds.txt
>  foreach val in "GBR" "FRA" "AUS" {
>
>  count if post_ifrs==0 & small_profit==1 &  country=="`val'" & sample_sum==1
>  scalar N1 = r(N)
>  count if post_ifrs==0 & small_profit==0 &  country=="`val'" & sample_sum==1
>  scalar N2 = r(N)
>  scalar odds=N1/N2
>  matrix m1 = N1, N2, odds
>  matrix rownames m1 = "Pre IFRS"
>  count if post_ifrs==1 & small_profit==1 &  country=="`val'" & sample_sum==1
>  scalar N3 = r(N)
>  count if post_ifrs==1 & small_profit==0 &  country=="`val'" & sample_sum==1
>  scalar N4 = r(N)
>  scalar odds2=N3/N4
>  matrix m2 = N3, N4, odds2
>  matrix rownames m2 = "Post IFRS"
>  matrix m3 = m1\m2
>  matrix colnames m3 = "Cases (Small profit)" "Controls (Small loss)" Odds
>  matrix list m3, title("`val'")
>  mat2txt, matrix(m3) saving(tabodds) append
>  tabodds small_profit post_ifrs if country=="`val'" & sample_sum==1
>  matrix m4 = r(chi2_tr), r(p_trend)
>  matrix colnames m4 = Chi2 Pr>chi2
>  matrix rownames m4 = "Score test for trend of odds"
>  matrix list m4
>  mat2txt, matrix(m4) saving(tabodds) append
>  }
>
>
>  ***********************************************************
>  Professeur/Professor
>  President of the French Accounting Association (AFC)
>  HEC Paris
>  Departement Comptabilite Controle de gestion / Dept of Accounting and Management Control
>  1, rue de la Liberation
>  78351 - Jouy-en-Josas
>  France
>  Tel: +33 1 39 67 94 42 - Fax: +33 1 39 67 70 86
>  mail: stolowy at hec dot fr
>  web: http://www.hec.fr/stolowy
>
>  *
>  *   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/
>
*
*   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/



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