Here's the debugging output
Code:
= local mat_input"\" 1, 2, 2, rsex_matcell[2,2], rtable[1,5+2], rtable[4,5+2], 
> rtable[5,5+2], rtable[6,5+2]
invalid syntax
The code is supposed to run a for loop and generate input for another matrix that looks like this
Code:
1, 1, 1, sex[1,1], rtable[1,6], rtable[4,6],rtable[5,6], rtable[6,6]\ 1, 1, 2, sex[1,2], rtable[1,7], rtable[4,7], rtable[5,7], rtable[6,7]\ 1, 1, 3, sex[1,3], rtable[1,8], rtable[4,8], rtable[5,8], rtable[6,8]
Here's the loop that is supposed to produce this
Code:
    local mat_input = ""
    forval c=2/`val'{
        forval d = 1 / 3 {
            if `c' == 2{
                local cache `a', `c', `d', `this_variable'_matcell[`c',`d'], rtable[1,`start'+`d'], rtable[4,`start'+`d'], rtable[5,`start'+`d'], rtable[6,`start'+`d']
            }
            else{
                local cache `a', `c', `d', `this_variable'_matcell[`c',`d'], rtable[1,"`start'+`d'+`c'"], rtable[4,"`start'+`d'+`c'"], rtable[5,"`start'+`d'+`c'"], rtable[6,"`start'+`d'+`c'"]
            }
            if "`mat_input'" == ""{
                local mat_input `cache'
            }
            else{
                local mat_input"\" `local mat_input'`cache'
            }
        
        }
    }
I would appreciate any help fixing this. Thanks in advance!