BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
DGBK
Obsidian | Level 7

I am trying to use the "Copy Files" task to export a .sas7bdat file to a file on our server.

 

When I start my workflow, I pull in a file using the copy method, which works completely fine. This allows me to save a backup of the table in a file. Unfortunately, I cannot figure out how to copy the updated file back to our server when the process ends. I get the following error:

 

ERROR: Object reference not set to an instance of an object.

 

Does anyone know how I can export a copy of the table using the "Copy Files" task? Is it possible I need to export it with a different extension?

 

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
DGBK
Obsidian | Level 7

I found that using the "Download Data Files to PC..." task was the way to accomplish what I wanted. The way to get there is to click on "Tasks" > "Data" > "Download Data Files to PC...".

View solution in original post

4 REPLIES 4
SASKiwi
PROC Star

Not sure exactly what you are doing here. What server are you referring to? So you are trying to copy from your SAS server where your EG programs run to another network server? If this is the case then the SAS server has to be able to reference folders on the other server.

DGBK
Obsidian | Level 7

Maybe I should rephrase my question. I want to save a copy of a SAS table as a sas7bdat file. I would like to be able to save it in a folder. This folder can be on my computer or on network resources. I currently copy a file from a network folder (picture it as a file on my desktop if that helps) into SAS EG, but I cannot figure out how to copy an altered version of it back to the folder. I get a complaint because it is a table instead of a file. 

 

Is there a way to do what I am asking using "Tasks>Data>Copy Files..." ? If this were a file with any other extension, the method I am using would work.

 

Thanks

Tom
Super User Tom
Super User

Can you explain more about that tool and how you are using it.

First does it support bi-directional copying?  Sounds like before you used it to move files into SAS and now you want to use it move a file out of SAS.

Second how did you tell it the name of the file you want to move?  If you created a dataset in SAS then normally you reference it as LIBREF.MEMNAME.  Where LIBREF is a pointer to the directory where the file exists. And MEMNAME is the basename of the file.  So if your SAS process created OUT.NEWFILE then to build the physical name of that file you could use :

data _null_;
  length filename $256;
  filename = catx('/',pathname('out'),cats('memname','.sas7bdat'));
run;

So if OUT points to /home/me/sasds then filename will be '/home/me/sasds/memname.sas7bdat'.  And that is the file you want to tell the COPY FILES task/step to copy.

DGBK
Obsidian | Level 7

I found that using the "Download Data Files to PC..." task was the way to accomplish what I wanted. The way to get there is to click on "Tasks" > "Data" > "Download Data Files to PC...".

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 2092 views
  • 1 like
  • 3 in conversation