Statalist


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

st: tabstatmat: are there difference between lab version vs non-lab versions? or a bug?


From   "User Stata" <statachina@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: tabstatmat: are there difference between lab version vs non-lab versions? or a bug?
Date   Tue, 25 Nov 2008 14:31:35 +0800

Dear Users,

   my students is using Stata 10.0 but find that tabstatmat cannot
work here properly

   please try the following program to test it

*program 1:

clear
set obs 100

forval i = 1(1) 2 {
  gen x`i' = uniform()
      }
gen y = uniform()>0.3
tabstat x1-x2, by(y) s(N mean sd ) c(s) long save
tabstatmat a

the output is as following:

. tabstatmat a

a[6,3]
               N       mean         sd
    0         24  .52799754  .31000402
    1         24  .56384267  .27788796
Total         76  .48501671  .30646846
Total         76  .51454554  .30574073
Total        100  .49533211  .30630202
Total        100  .52637685  .29867098


the program here is that the last four rows are all lebeled as Total

with the following program, you will find more serious problems:




 clear
set obs 100

forval i = 1(1) 4 {
  gen x`i' = uniform()
      }
gen y = uniform()>0.3
tabstat x1-x4, by(y) s(N mean sd ) c(s) long save
tabstatmat a


clear
set obs 100

forval i = 1(1) 4 {
  gen x`i' = uniform()
      }
gen y = uniform()>0.3
tabstat x1-x4, by(y) s(N mean sd ) c(s) long save
tabstatmat a


. tabstatmat a
conformability error
r(503);

end of do-file

r(503);


actually i find that when there are more than 4 variables, this error
will always appear


in another of my program, i even find another error message:


. tabstat emp RD2 RND_D np2 np_d new_process if SOE & year==2002,
by(sector) save

Summary statistics: mean
  by categories of: sector

          sector |  employee       RD2     RND_D       np2      np_d  new_pr~s
-----------------+------------------------------------------------------------
Garment & leathe |  4.715734  .0016361  .1397849  .0487634  .1182796  .2043011
Electronic equip |   5.12713  .0170868  .5517241  .1807552  .4655172  .6034483
Electronic parts |    5.0808  .0145687  .4363636  .1641173        .5  .4818182
Auto & auto part |  5.595137  .0107206  .4388489  .1765173  .5035971  .4460432
 Food processing |  5.108645  .0016465        .3   .124515        .4        .4
Chemical product |  5.082825  .0024898  .2258065  .0319387  .2580645  .2580645
Metallurgical pr |  4.911888  .0179259  .2597403  .0970013  .2987013  .2727273
Transportation e |   3.84033  .0000513  .0833333     .0125  .0833333  .0833333
-----------------+------------------------------------------------------------
           Total |  5.104794  .0106054  .3481481  .1272354  .3759259  .3833333
------------------------------------------------------------------------------

. tabstatmat SEO_sectors
Metallurgicalproducts(manuf:  operator invalid
r(198);

end of do-file

r(198);


-- 
Chuntao Li
Chinese Academy of Finance and Development
Central University of Finance and Economics
Beijing, China
*
*   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/



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