BookmarkSubscribeRSS Feed
Jonas_Jing
SAS Employee

I have an existing data step code to download a .sas7bdat table from http endpoint, and save it into the WORK library, and then read the data in it.

The code is like this:

 

filename cp_src filesrvc folderpath="/Public" name="hmeq_train.sas7bdat" recfm=N lrecl=32767;

* Save the table to work.hmeq_train;
filename cp_tgt "hmeq_train.sas7bdat" recfm=N lrecl=32767;

data _null_;
    fcopy('cp_src','cp_tgt');
run;

proc print data=work.hmeq_train;
run;

 

But this is in single thread. I have tens of binary .sas7bdat files needs to be downloaded at the same. I noticed that DS2 can leverage multi-thread ability to run program concurrently. But I tried fcopy() or INFILE statement, they both don't work in DS2.

Is there a way to do the same thing in DS2?

3 REPLIES 3
yabwon
Amethyst | Level 16

Since you are using filesrvc method, it looks like your data are on your Viya server, is that right? 

 

If those files located in a single directory?

If yes you could use PROC COPY to get data from one location to another:

 

libname a ".../Public";
proc copy in=A out=work;
run;

If those files are in multiple locations you can create "combined" library, and also use PROC COPY:

 

 

libname a (".../Public1" ".../Publuic2" ".../Public3");
proc copy in=A out=work;
run;

 

 

 

Bart

 

 

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



Kurt_Bremser
Super User
  • This is not HTTP, this is the SAS Viya File Service
  • You would copy the file to the current working directory of your SAS process, which is (unless you change it explicitly in your code) different from WORK
  • Massive parallelization of I/O can easily lead to an overload of your storage subsystem, resulting in serious overall performance degradation, and no net gain
SASKiwi
PROC Star

@Jonas_Jing - I think you have an IO issue with copying multiple files not a multi-threading restriction. I believe you could use SAS/CONNECT, which comes with Viya, and start several SAS sessions and simulaneously download multiple files that way.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 3 replies
  • 386 views
  • 0 likes
  • 4 in conversation