Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to export CSV with multiine text data

    I have a CSV file in which some of the columns contain multiline text data. See below. Sample file attached.
    Click image for larger version

Name:	image_24473.png
Views:	2
Size:	82.6 KB
ID:	1635377



    To import it safely, I have to use bindquotes

    Code:
     
     import delimited using "output-16350782302.csv", bindquote(strict) maxquotedrows(10000)
    After running my analyses, I want to save the data frame into a new csv (let's say output.csv) Unfortunately, the export doesn't work as expected - the multi-line description_story (and description_risk) gets broken up...`export delimited` command does not have a bindquote(strict) option... Any suggestions on how to safely export this multiline text data?

    Attached Files
    Thank you for your help!

    Stata SE/17.0, Windows 10 Enterprise

  • #2
    Have you tried the -quote- option? I haven't tried this myself but it seems reasonable.

    Comment


    • #3
      What -quote- option? I couldn't find anything in the manual about it...
      Thank you for your help!

      Stata SE/17.0, Windows 10 Enterprise

      Comment


      • #4
        See -help export delimited- then read down till you see the -quote- option for export options. It claims to always wrap strings in quotes, which might provide sufficient structure for you to export your data as a CSV file.

        Comment

        Working...
        X