Announcement

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

  • Clean up matrices

    Hello everyone,

    I am trying to understand one code and apparently, everything is clear. But since there has been a lot of working behind the loop and i cannot see line by line what the code does in some of the parts. Here is the part of the code which clears the matrices after running the regression

    Code:
    * Clean up matrices for output
        foreach col in `colnames'  {
            local n=`n'+1
            mat c`n'=var[`n'..., `n']
            local rownames: rown c`n'
    
            foreach w of local rownames  {
                local rw_c`n' `rw_c`n'' `w'_`col'
            }
            
            matrix rown c`n'= `rw_c`n''
            matrix coln c`n'= `v'
            matrix se=(nullmat(se)\ c`n')
            cap mat drop c`n'
            local rw_c`n' ""
        }
    Here col is the columns which are different variables. Can somebody explain me row by row what this code does? For instance, in the last line, i understand local assigned string to macro name but what this is actually doing I don't know. These are 12 lines if you can even explain few I will be grateful. Thanks

    Note: v here is local for all the output which are precisely 6 variables means 6 columns.
    Last edited by Syed Raza; 02 Jun 2018, 08:27.
Working...
X