ENH: Add class to write dta format 117 files
State: closed

Add export for dta 117 files which add support for long strings
Refactor StataWriter to simplify new writer

closes #16450

- [x] closes #16450
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry


Labels:
name: Enhancement
name: IO Stata
description: read_stata, to_stata

Comments:
Hello @bashtage! Thanks for updating the PR.







Cheers ! There are no PEP8 issues in this Pull Request. :beers: 

##### Comment last updated on May 01, 2018 at 18:57 Hours UTC
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/20844?src=pr&el=h1) Report
> :exclamation: No coverage uploaded for pull request base (`master@ade293d`). [Click here to learn what that means](https://docs.codecov.io/docs/error-reference#section-missing-base-commit).
> The diff coverage is `80%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/20844/graphs/tree.svg?token=eZ4WkYLtcO&src=pr&width=650&height=150)](https://codecov.io/gh/pandas-dev/pandas/pull/20844?src=pr&el=tree)

```diff
@@            Coverage Diff            @@
##             master   #20844   +/-   ##
=========================================
  Coverage          ?   91.78%           
=========================================
  Files             ?      153           
  Lines             ?    49349           
  Branches          ?        0           
=========================================
  Hits              ?    45295           
  Misses            ?     4054           
  Partials          ?        0
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.17% <80%> (?)` | |
| #single | `41.93% <0%> (?)` | |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/20844?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/20844/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.13% <80%> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/20844?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/20844?src=pr&el=footer). Last update [ade293d...2d54ded](https://codecov.io/gh/pandas-dev/pandas/pull/20844?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

Is it intentional that `stata.py` is not covered?  Seems a bit strange. 
> Is it intentional that stata.py is not covered? Seems a bit strange.

what does this mean? the coverage that prints on the issue is odd (and has always been that way), but you can click thru and see the actual reports.
> what does this mean? the coverage that prints on the issue is odd (and has always been that way), but you can click thru and see the actual reports.

For some reasn it isn't showing up in codecov at all.  

See 

https://codecov.io/gh/pandas-dev/pandas/pull/20844/tree/pandas/io

for coverage fo this PR.  stata.py is missng as are other files in io.py.  

The master coverage is also wrong.

https://codecov.io/gh/pandas-dev/pandas/tree/master/pandas/io

Might be a bug in codecov. 

`excel`, `pickle`, `stata`, and `sql` are all missing.
> minor comments. Might consiser renaming StataWriter to StataWriter114 (and essentially make it private). Otherwise lgtm.

I think this would need a dep cycle since `StataWriter` has been public.  Can do this if you want. 
@jreback Green and ready.
@jreback are you OK with merging this as is? I'll fix the git conflict on merge.
yep this is fine
if we need follow ups after RC that is fine
K. @bashtage I'm going to fix the conflict and then merge. A followup PR would be welcome.