title: subsetting columns of a matrix by using column names
body: <p>I'm sorry if this is a basic question, but I couldn't find any solution, neither here nor on the Stata manual (chapter 14, "Matrix expressions").</p>
  
  <p>My goal is to subset a matrix by using column names.
  My initial matrix <code>A</code> looks like this:</p>
  
  <pre><code>mat A = (1,2,3\4,5,6\7,8,9)
  mat rownames A = "row a" "row b" "row c"
  mat colnames A = "col x" "col y" "col z"
  
  mat list A
  </code></pre>
  
  <p>I need to create a matrix that is composed by the first and the last columns using the column names <code>col x</code> and <code>col z</code>.
  The "closest" thing I was able to perform is:</p>
  
  <pre><code>mat B = A[.,"col x".."col z"]
  </code></pre>
  
  <p>which is clearly wrong. Any other attempt resulted in a matrix <code>B</code> composed by the first column only.
  What am I missing here?</p>