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

Hello Guys,

 

I wonder is there any possibility to run a SAS program against two different linux server at the same time? For Eg:- I have code which should read the file name in particular path from server X and Server Y and store it in to the data set library which resides in server X.

 

Please let me know if there any programmatic way or admin level solution to do that. Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

So you want to create a list of files which are stored in separate paths on separate servers?

 

I'd try to read the directory listings with sftp, and later combine the results into one dataset:

filename sftpcmd pipe "echo 'ls *'|sftp -q user@server:/path";

data dir1;
infile sftpcmd;
length line $100;
input;
line = _infile_;
if substr(line,1,4) not in ('Conn','sftp') and substr(line,length(line)) ne '/';
run;

You need to have public/private key authentication, so you don't need a password.

View solution in original post

3 REPLIES 3
Kurt_Bremser
Super User

So you want to create a list of files which are stored in separate paths on separate servers?

 

I'd try to read the directory listings with sftp, and later combine the results into one dataset:

filename sftpcmd pipe "echo 'ls *'|sftp -q user@server:/path";

data dir1;
infile sftpcmd;
length line $100;
input;
line = _infile_;
if substr(line,1,4) not in ('Conn','sftp') and substr(line,length(line)) ne '/';
run;

You need to have public/private key authentication, so you don't need a password.

arunrami
Pyrite | Level 9

Hi Brem, Thanks for your response. But when I tried the below syntax you given I am getting an following error message, Could you please suggest me some way to overcome it ??

Note: Instead of user name - I given my username, and for server- given meta data server which we are going to access from different server, path- particular path from that server


ERROR: Insufficient authorization to access PIPE.
ERROR: Error in the FILENAME statement.

ERROR: No logical assign for filename SFTPCMD.

Kurt_Bremser
Super User

Which means that the default NOXCMD option is in place in your SAS server setup. So you either need to have that enabled by the SAS administrator, or find another way to connect to the servers. If all participating servers have SAS installed, and SAS/CONNECT licensed, you could use that, and the file functions from within SAS.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 996 views
  • 2 likes
  • 2 in conversation