Announcement

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

  • Count nonmissing rows

    I want to count all such rows where no missing exists. For example, the following matrix with 10 rows and 4 columns have missing values in the first 4 rows, so the non-missing rows are 6. How to get the number 6 in a most efficient way.
    Code:
    W=uniform(10,4)
    W[1,1]=.
    W[2,4]=.
    W[3,3]=.
    W[4,2]=.
    W
                   1             2             3             4
         +---------------------------------------------------------+
       1 |            .    .643220668   .5578016951   .6047949435  |
       2 |   .684175977   .1086679425   .6184581316             .  |
       3 |  .5552388297   .8714490768             .   .0445188014  |
       4 |  .4241557193             .   .5219247625   .8414094402  |
       5 |  .2110076593   .5644091703   .2648020918   .9477426449  |
       6 |  .2769154108   .1180158504   .4079702524   .7219491643  |
       7 |  .8716910495   .4611428848   .4216726252    .894474573  |
       8 |  .0580661548   .6759487262   .7152804767   .6990690373  |
       9 |  .2322687705   .0981877826    .594840399   .3533873679  |
      10 |  .8071709252   .1024369358   .5773884314   .1091783417  |
         +---------------------------------------------------------+

  • #2
    Code:
    sum(rowmissing(W) :== 0)

    Comment

    Working...
    X