Announcement

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

  • Design flaw in -screeplot- or even a bug in -return-?

    According to documentation, screeplot returns in a macro and matrix both under the same name r(ci). This obviously leads to problems accessing the returned results. Is this a design flaw in screeplot? Is this even intended behavior of return?

  • #2
    Seem like a bug in return. Occurs if return matrix is last and the matrix name is different from return(name).
    Code:
    capt prog drop testit 
    prog def testit, rclass 
    
        local ci ci
        matrix CI =  1,2 
        
        return local ci  `ci'
        return matrix ci CI  // matrix last with different matrix name
        
    end    
    
    testit
    return list
    Code:
    macros:
                     r(ci) : "ci"
    matrices:
                     r(ci) :  1 x 2

    Comment


    • #3
      We are thinking in the same direction. I also noticed that you cannot obtain the same result when you return the macro after the matrix:

      Code:
      . capt prog drop testit 
      
      . prog def testit, rclass 
        1. 
      .     local ci ci
        2.     matrix CI =  1,2 
        3.     
      .     return matrix ci CI 
        4.     return local ci  `ci'
        5.     
      . end    
      
      . 
      . testit
      
      . return list
      
      macros:
                       r(ci) : "ci"
      This inconsistent behavior, and the documentation, lead me to believe that return does not behave as intended here.

      Comment

      Working...
      X