Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to count the number of rows and columns of a non-null values in matrix?

    Hello, I am new to Mata and how do you count the number of rows and columns of a non-null values in matrix. Of course, We can exchange rows and columns, so at least columns or rows non-empty number can be calculated.lots of command can get the results,but i should do this by matrix or mata. Thank you very much for example T=(1,1,4, . \ 2,2,5,12 \ 3,3,6,13 \ 4, . ,7,11 \ 5,5,8,. \ 6,6,9,18 \ 7,7,., 20 \ 8,8, . ,21 \ 9,9,12,23 \ 10,10,13, .) the wanted matrix should be as follow: wanted = (10,9,8,7) the number of the wanted matrix represent the number of non-null values in each column.

  • #2
    You probably want colnonmissing(). Note that missing values (., .a, .., .z) are not called "null" values in Stata.

    Comment


    • #3
      thank you very much ,it's very kind of you

      Comment

      Working...
      X