title: How can I store a list of variable names in Stata when the list is longer than 244 characters?
body: <p>I'm writing a Stata plugin, and the plugin needs to know the order of variables to access data. To deal with this, I built a C++ function that searches a macro containing the variable list for the proper location. However, this is restricted by the length of a string in Stata.</p>
  
  <p>I am currently getting the variable list as follows:</p>
  
  <pre><code>qui ds
  local varlist = "`r(varlist)'"
  </code></pre>
  
  <p>But this will only give me the first 244 characters.</p>
  
  <p>Is there a way I can get a macro that contains the names of all variables even if the list is longer than 244 characters? Is there some other efficient way I could get the variables into my plugin?</p>