title: Writing failure: A provided name contains an illegal character. Error while saving R data into Stata format
body: <p>I am using haven package to write the R dataset into Stata format.</p>
  <p>This is the error I am getting.</p>
  <p><code>write_dta(road_panel, &quot;road_panel.dta&quot;, version = 14, label = attr(data,&quot;label&quot;))</code></p>
  <p><code>Error in write_dta_(data, normalizePath(path, mustWork = FALSE), version = stata_file_format(version),  :  Writing failure: A provided name contains an illegal character.</code></p>
  <p>I also tried a slightly different code but its the same.</p>
  <pre><code>`write_dta(road_panel, &quot;road_panel_stata.dta&quot;)
  </code></pre>
  <p><code>Error in write_dta_(data, normalizePath(path, mustWork = FALSE), version = stata_file_format(version),  :  Writing failure: A provided name contains an illegal character.</code></p>
  <p>How can I successfully export the data into Stata format?</p>
  <p>The output of names(road_panel):</p>
  <p>[149] &quot;road_comp_date_new_year_final&quot;      &quot;road_comp_date_upg_year_final&quot;      &quot;road_comp_date_stip_new_year_final&quot; &quot;road_comp_date_stip_upg_year_final&quot;
  [153] &quot;year&quot;</p>