When I run a local variable through an if statement, it gives me the invalid name error
Code:
    local mat_input = ""
    forval c=1/`val'{
        forval d = 1 / 3 {
            if `c' == 1{
                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'
            }
        
        }
    }
Here's the debugging log
Code:
- if `mat_input' == ""{
= if  == ""{
=="" invalid name
  local mat_input `cache'
  }
I can't figure out what error I'm making since my variable `mat_input' is defined. I searched on Google and found some other threads but they're not exactly related to what I'm seeing here.