title: Does the equivalent of matlab's xlswrite() exist for Stata?
body: <p>I need to export several matrices created in Stata to several different specifically named sheets of an already existing excel file.  This would be a piece of cake in Matlab using xlswrite().  I am having trouble finding a similar command in Stata.</p>
  
  <p>"xml_tab" would work but it doesn't seem to want to let me open and make changes to an <em>already existing</em> excel file.  It always starts by creating a new excel file.</p>
  
  <p>I would appreciate some help as to how I might get "xml_tab", or some other Stata command, to open an already existing excel file, make changes to it (overwriting specific sheets with new matrices), and then save it without overwriting all the other stuff on the other sheets that I don't want to touch.</p>
  
  <p>Can Stata do that?</p>
  
  <p>Thanks</p>
  
  <p>EDIT:</p>
  
  <p>An example of what I need to do is this:</p>
  
  <pre><code>    *Define poverty line
      scalar povlin=29347.5
      *1) SETUP sheet
      mat SETUP=(1,J(1,3,0),1,J(1,2,0),1,1,J(1,5,0),povlin)
  
      /* Here I need to export the matrix SETUP to sheet "SETUP" in an 
      already existing excel file.  In matlab it would be
      xlswrite('filename','SETUP','A2')  */
  
      *2) FARM sheet
      tabstat acres,stat(sum) save
      mat acrtot=r(StatTotal)
      tabstat aehh07 offrinc07,save
      mat vmeans=r(StatTotal)
      mat maehh=vmeans[1,1]
      mat moffrinc=vmeans[1,2]
      tabstat aehh07 offrinc07 acres,stat(cv) save
      mat CV=r(StatTotal)
      tabstat acres,save
      mat macres=r(StatTotal)
      mat FARM=(1,acrtot,maehh,CV[1,1],moffrinc,CV[1,2],moffrinc,CV[1,2],J(1,3,0),macres)
  
      /* Here I need to export the matrix FARM to sheet "FARM" in the 
      same already existing excel file where I put the SETUP matrix.  In matlab it would 
      be xlswrite('filename','FARM','A2')  */
  </code></pre>
  
  <p>I need to do this kind of thing for several sheets.</p>