Announcement

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

  • Defining a variable fitting to the size of a matrix

    Hey everyone,
    im still new to stata so this is probably still a trivial question . for further computations i'd like to define a variable that adjusts itself to the number of variables of the quadratic matrix i work with. so e.g.i put in a 9x9 quadratic matrix my variable should be n = 9 in this case. thanks for any help!!

    Best

  • #2
    What do you need that the mata rows() and/or columns() functions do not provide?
    Code:
    . mata:
    ------------------------------------------------- mata (type end to exit) ------
    : A = I(3)
    
    : n = rows(A)
    
    : A
    [symmetric]
           1   2   3
        +-------------+
      1 |  1          |
      2 |  0   1      |
      3 |  0   0   1  |
        +-------------+
    
    : n
      3
    
    : end
    --------------------------------------------------------------------------------

    Comment


    • #3
      Oh its actually as simple as that thanks a lot!!

      Comment

      Working...
      X