The Copy Files task is going legit (and moving)

17

I've supplied dozens of custom tasks for SAS Enterprise Guide, but the Copy Files task is easily the most popular. The Copy Files task allows you to capture "file transfer" steps inside your process flow, so that you can automate any file upload and download operations between your PC and your SAS workspace session. It has proven to be an essential task for customers who move from using PC SAS to SAS Enterprise Guide. Many of you still need a method to copy data and results to and from your SAS session. When the SAS session is on a remote server, then this task fills that important gap.

Because "Copy files" is a custom task, you have to download the task package (from this blog) and follow a few steps to install the task into your SAS Enterprise Guide environment. When installed, the task can be found in the Tools → Add-In menu.

Copy Files task moves to the Tasks → Data menu

Copy Files in new menuThat's about to change with the next release: SAS Enterprise Guide v7.13. We're going to make an honest task out of "Copy Files," as it becomes an official feature in SAS Enterprise Guide. That's great news for a couple of reasons: no more custom install steps, and you can now get official support from SAS Tech Support when using it (although they would have always helped before now). The task works exactly the same way and if you have existing projects that use it, you don't need to make any changes. However, there is one change you need to know about: as an "official" task, it will appear in an official menu location. As of SAS Enterprise Guide 7.13, you'll find Copy Files in the Tasks → Data menu, near the bottom with some other utility-type tasks. And if you had previously installed it as a custom task, it will no longer appear in the Tools → Add-In menu.

SAS Enterprise Guide 7.13 is set to release within the next couple of weeks (near the end of November 2016), and it contains several exciting new features that I'll describe in this blog. Many of you will see it immediately when SAS Enterprise Guide prompts you to update. Stay tuned!

Share

About Author

Chris Hemedinger

Senior Manager, SAS Online Communities

+Chris Hemedinger is the manager of SAS Online Communities. Since 1993, Chris has worked for SAS as an author, a software developer, an R&D manager and a consultant. Inexplicably, Chris is still coasting on the limited fame he earned as an author of SAS For Dummies.  He also hosts the SAS Tech Talk webcasts each year from SAS Global Forum, connecting viewers with smart people from SAS R&D and the impressive work that they do.

Related Posts

17 Comments

  1. Pingback: There and back again: copying files in SAS Enterprise Guide - The SAS Dummy

  2. Chris,

    I am trying to update my SAS EG version from 7.12 to 7.13 via the 'check for updates' option but it does not work. Does this mean i will have to request a new dump for 7.13 and install it ?

  3. I've Googled this back and forth, please help and forgive if this is a conversation on some other thread. (Because I know I read that thread somewhere...) ?Is there a listing or collection of SAS EG custom tasks that certain authors have either made available or advertised?

  4. Pingback: Export and download any file from SAS Enterprise Guide - The SAS Dummy

  5. Chris - Thanks for the tool. We are still on EG 7.10 and the tool has been invaluable.

    Is there a SAS task to to delete the files that are left on the SAS server and free up space?

    • Chris Hemedinger
      Chris Hemedinger on

      Anjan, if you don't mind writing a little bit of code, you can use the FDELETE function. You can also produce all of the results that you intend to download in a TEMP area (for example, the same folder as WORK). When the SAS session ends, those files will be deleted. Use %sysfunc(getoption(WORK)) to find the root folder for WORK in your session.

  6. The copy files task is a great tool. I am using it within EG 7.13. Question, if the copy files task has an error and does not complete successfully, is there a way to have the next step in the process flow stop processing? I have my project properties for "Action to take on errors during execution" set to "Stop current branch" but it does not stop when the copy files task has an error so seems like it isn't picking up the error from that task. Appreciate any suggestions!

    • Chris Hemedinger
      Chris Hemedinger on

      Good question! I'm guessing that No, since this task doesn't generate a "natural" SAS error, it might not be picked up in the logic for the flow. As a workaround, you might have to add a code-based check for existence of a file (assuming you're uploading into the SAS session) and trigger an error off of that. And I'd suggest reporting your case to SAS Tech Support, so they can track as a bug for a future fix or perhaps provide a better workaround.

  7. Hi, Chris,

    I'm using the "legit" Copy Files task in EG 7.15, 64 bit. I'm moving over .sas code that is then brought into my programs via a %INCLUDE command. In other words, I use EG as my editor on my local Windows machine and then use the Copy Files task to make sure that I've always got the latest version of the SAS code on our UNIX server before beginning execution. It's great... except when it isn't. Copy Files frequently doesn't actually update the remote SAS code. No errors or warnings are issued; the log file seems to indicate that all is well, but when one browses the code on the remote server, it's still and older version.

    Naturally, I just know you'll suggest something like OPTION=START_WORKING_DOGGONE_IT and all my problems will be solved. :) Well, perhaps it won't be *that* easy, but I'm hoping that there may be some telltale in the log that I just don't know about or perhaps some kind of sharing option that I'm not aware of that is preventing the files from being updated.

    Suggestions most welcome,

    Jim

    • Chris Hemedinger
      Chris Hemedinger on

      Hi Jim, this is a good use of the task. I'm not sure what's going on where it doesn't always update the file. Is it possible that the file is currently open/locked by another process, and the update fails? Or...is it possible that the Copy Files task doesn't actually run *before* the code that %INCLUDEs the file you meant to copy? I suggest using a defined link (arrow) in the process flow (if you're not already) to "force" that Copy Files task to complete before the next code step runs.

      • Hi, Chris,

        Yes, I include the task in the Process Flow with an arrow from the Task to my first program which in effect requires the Task to complete before my programs run.

        It appears to be working just fine today, so, um, I'm glad I mentioned it. :) I'll keep an eye on it, and I'll copy the relevant sections of the log here if the problem recurs. I may have just had something futzed up and re-booting my machine (which I did after I made my comment, above) cleared the problem. I did have one "hung" instance of SAS EG at the time. There was no application open, but I could see an EG process in my Windows Task Manager.

        Jim

  8. Silly question, perhaps...
    What's the syntax to copy from the server WORK library to a local folder?

    Thanks,
    James

Leave A Reply

Back to Top