BookmarkSubscribeRSS Feed
vivekpn_sas
Calcite | Level 5
Hi experts,

I need a very genuine help for my project . Wants to code the copying file from sas to local pc so I can automate it to SMC. Pls advice if it's possible to code it through SAS
7 REPLIES 7
Kurt_Bremser
Super User

I suggest to use a shared network resource that is accessible both from your client and the SAS server.

Copying from a SAS program on the server directly to your PC requires that your PC is up and running all the time, and running file transfer server software, something which is usually not appreciated by IT people.

vivekpn_sas
Calcite | Level 5
Thanks for your response first. I am trying to copy to a shared windows path only. But not sure of what is the code to do so. To copy a file from sas to windows shared path
Kurt_Bremser
Super User

If you want to share a SAS dataset, you just define a library (LIBNAME) to the shared location and use it to create the dataset.

if you want to share the output of a procedure, use the appropriate path to the shared resource in the respective ODS statement.

Similarly, you can use the path to the shared resource in FILENAME or FILE statements when exporting to external files, or in the OUTFILE= option of the PROC EXPORT statement.

 

The most important part is that the shared resource has to be available on the SAS server. If that is a Windows system, the UNC path should work, if it is Linux/UNIX, you need the shared resource mounted on the server.

vivekpn_sas
Calcite | Level 5
As per my understanding we can't use proc export to copy a dataset nor naming a windows paths to a library will work. Can u share the piece of code. Anyone knows it pls share I will try in my system of it works
Kurt_Bremser
Super User

Before we start tinkering with SAS code, we need to make sure that the shared resource is available on the server. Log on to it with your SAS userid using any kind of SSH client, and see if you can navigate there; if you have trouble with this, get in touch with your server admins.

SASKiwi
PROC Star

What does "so I can automate it to SMC" mean? Why do you need to copy a SAS dataset to your local PC? If your Windows(?) SAS server storage is accessible via file shares it could be as simple as going into Windows Explorer and doing a copy and paste.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 2527 views
  • 0 likes
  • 3 in conversation