Announcement

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

  • matrix rownames for Stata15.1 and 16.1

    Hi,

    I have two Stata installed, MP15.1 on my local computer and MP16.1 on a server. When I ran the following code, it was perfectly fine for MP15.1.

    . matrix mymat = (1,2\ 3, 4)
    . global newname 0b.physn_male#1b.physn_age_cd(<40)
    . matrix rownames mymat = $newname
    . matlist mymat, twidt(30)

    | c1 c2
    -------------------------------+----------------------
    0b.physn_male#|
    c.1b.physn_age_cd(<40) | 1 2
    0b.physn_male#|
    c.1b.physn_age_cd(<40) | 3 4

    But on MP16.1, it gave me an error message as following
    . matrix mymat = (1,2\ 3, 4)
    . global newname 0b.physn_male#1b.physn_age_cd(<40)
    . matrix rownames mymat = $newname
    invalid matrix stripe;
    0b.physn_male#1b.physn_age_cd(<40)
    r(198);

    Is this related to the different version of Stata? Any advice is appreciated. Thanks.

    Haiyong


  • #2
    I think that this is a bug. The issue appears to be with how Stata parses the right (closing) parenthesis in Stata 16.

    Code:
    matrix mymat = (1,2\ 3, 4)
    mat rowname mymat= 0b.physn_male#1b.physn_age_cd(<40)
    mat rowname mymat= 0b.physn_male#1b.physn_age_cd(<40
    matlist mymat, twidt(30)
    mat rowname mymat= 0b.physn_male#1b.physn_age_cd[<40]
    matlist mymat, twidt(30)
    I also confirm that the issue does not occur in Version 15. You should send a report to Technical Services.

    Res.:

    Code:
    .
    . mat rowname mymat= 0b.physn_male#1b.physn_age_cd(<40)
    invalid matrix stripe;
    0b.physn_male#1b.physn_age_cd(<40)
    r(198);
    
    .
    . mat rowname mymat= 0b.physn_male#1b.physn_age_cd(<40
    
    .
    . matlist mymat, twidt(30)
    
                                   |        c1         c2
    -------------------------------+----------------------
                     0b.physn_male#|                      
             c.1b.physn_age_cd(<40 |         1          2
                     0b.physn_male#|                      
             c.1b.physn_age_cd(<40 |         3          4
    
    .
    . mat rowname mymat= 0b.physn_male#1b.physn_age_cd[<40]
    
    .
    . matlist mymat, twidt(30)
    
                                   |        c1         c2
    -------------------------------+----------------------
                     0b.physn_male#|                      
            c.1b.physn_age_cd[<40] |         1          2
                     0b.physn_male#|                      
            c.1b.physn_age_cd[<40] |         3          4
    
    .
    Last edited by Andrew Musau; 16 Mar 2022, 08:01.

    Comment

    Working...
    X