Announcement

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

  • How to write/export files over Internet from within Stata?

    To update table data on our website (PEBL.dk), from within Stata, I need to be able to write csv-files over Internet to be stored in a Microsoft Azure storage account.
    Our CMS software then automatically reads the csv-files from this storage account.

    I can manually upload a csv-file to the Microsoft Azure storage account.

    From within Stata, I am able to read in the csv-file from the storage account using the -import- command:
    . import delimited https://paestoragep01.blob.core.wind...b-p01/Test.csv
    (encoding automatically selected: ISO-8859-1)
    (8 vars, 30 obs)

    When I then try to export data to the same place, I get the following error:
    . export delimited using https://paestoragep01.blob.core.wind...b-p01/Test.csv, replace
    may not write files over Internet
    r(603);

    Is there a way around this limitation?

    Or, do you know how to manage this procedure in some other way?
    The problem is that our CMS software needs to read in csv-files from an internet url!


    Best regards,
    Kim

  • #2
    Originally posted by Kim Lyngby Mikkelsen View Post
    Is there a way around this limitation?

    Or, do you know how to manage this procedure in some other way?
    The problem is that our CMS software needs to read in csv-files from an internet url!
    Stata cannot write to aribitrary URLs and I don't think any software can do precisely this. At a guess, a workaround could be to write the file to your local disk and then upload it to your server (either manually or by sFTP, for example). Another potential way is to mount the network drive to your computer so that your operating system, and therefore Stata, sees the drive as a medium it can write to. The specifics depend very much on your specific setup, so your best bet will be to contact your IT support for help on the next steps.

    I am also surprised that your CMS software cannot upload a local file, but I take you at your word.

    Comment


    • #3
      Azure supports SFTP and much of the rest of SSH. Stata allows you to invoke console commands, so it should be possible to write the file and upload all from a do file. It could get complicated though, particularly if you are on a version of Windows older than Windows 10, or if you don't have administrative access to your computer.

      Comment

      Working...
      X