title: Does Stata have any `try and catch` mechanism similar to Java?
body: <p>I am writing a <code>.do</code> to check the existence of some variables in a number of <code>.dta</code> files as well as to check the existence of certain values for those variables. However, my code stops executing as it encounters an invalid variable name.</p>
  
  <p>I know I mix Java and Stata coding, and it is completely inappropriate, but is there any way I could do something like:</p>
  
  <pre><code>try {
  su var1
  local var1_mean=(mean)var1
  local var1_min=(min)var1
  local var1_max=(max)var1
  ...
  }
  catch (NoSuchVariableException e) {
  System.out.println("Var1 does not exist")
  }
  // So that the code does not stop executing...?
  </code></pre>