Statalist


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

st: matrix question


From   moleps islon <moleps2@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: matrix question
Date   Sat, 8 Aug 2009 17:59:02 +0200

That is exactly what I'm looking for, however applying your code to my
program doesnt work ( though your code works beautifully). I end up
with r503 conformability error. And also instead of a [8,4] matrix I
get a [1,24] matrix.

Moleps


capture  program drop  bif_des
program bif_des
capture drop _*
quietly des,varlist

local r `r(varlist)'
di "`r'"
tokenize `r'
local first `1'
macro shift
local rest `*'

local t:word count `rest'

tokenize `rest'
forval o=2(2)`t' {

       local rowname `rowname' ``o''
       gen _``o''pos=1 if (``o''>0 & ``o''<.)
       replace _``o''pos=0 if (``o''<0)
       estpost tab _``o''pos,mi
       matrix def o=e(pct)
       matrix def l=e(cumpct)
       mat A=(nullmat(A),(o[1,1..2],l[1,2])')
       mat list A
       }
mat rownames A = `rowname'

end
*
*   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