BookmarkSubscribeRSS Feed
alepage
Barite | Level 11
filename DIRLIST pipe 'dir "C:\Temp\Temp\Temp2" /s';

data dirlist ;
     length buffer $256 ;

     infile dirlist length=reclen ;

     input buffer $varying256. reclen ;
run ;

I have tried this code and it is not working at all.

Is it possible to get the files listing of a directory hosted on c drive while using SAS EG on unix server

 

5 REPLIES 5
Reeza
Super User
If the directory is mapped and accessible to the Unix server, Yes.

ballardw
Super User

"Not working" is awful vague.

Are there errors in the log?: Post the code and log in a code box opened with the "</>" to maintain formatting of error messages.

No output? Post any log in a code box.

Unexpected output? Provide input data in the form of data step code pasted into a code box, the actual results and the expected results. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the "</>" icon or attached as text to show exactly what you have and that we can test code against.

 

Strongly suspect that your EG is connecting to a server on the network and that your local C: drive is not mapped to be seen by the server, or if it is mapped is not referred to as "C:" from the server's viewpoint.

alepage
Barite | Level 11
 

alepage_0-1655903956734.png

options xcmd; 
x "/mnt/c/Temp/Temp/Temp2/"; 

%let path=C:\Temp\Temp\Temp2;
%let path=/mnt/c/Temp/Temp/Temp2/;

filename DIRLIST pipe 'dir "&path." /s';

data dirlist ;
     length buffer $256 ;

     infile dirlist length=reclen ;

     input buffer $varying256. reclen ;
run ;

In the first window, you will see the error messages while in the second one, you will see my SAS code.  The first %let path statement is the real location of my directory.  The second %let path statement is something I saw on the web for Unix but it does not work better.

 

You have mentionned that my C drive is not mapped or not visible from our Unix server.

Is there anything I could do in term of SAS code to do that ?  Please note that our Unix server is access through a vpn connection.  With WinScp , it is possible to see the C drive and all the folders on our Unix server but Winscp is not SAS EG.

 

Is there a work around solution possible?

Quentin
Super User

I think you will need to work with your unix admin to try and get your C: drive (or more likely a windows network drive) mounted to unix so that unix can see the files there.

 

Your second path you got from the internet:

/mnt/c/Temp/Temp/Temp2/

likely shows a case where the user had mounted a windows folder to unix  ( /mnt is a common abbreviation for mount ).

 

WinSCP can see your C: drive because it is running on Windows.

 

EG can see your C: drive because EG is running on Windows.

 

When you use EG to submit SAS code to a unix server, the SAS job can only see files that are available to the unix server where it is running.

BASUG is hosting free webinars Next up: Mike Raithel presenting on validating data files on Wednesday July 17. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
Reeza
Super User

@alepage wrote:

 

Please note that our Unix server is access through a vpn connection.  With WinScp , it is possible to see the C drive and all the folders on our Unix server but Winscp is not SAS EG.

 

Is there a work around solution possible?


If your company has chosen to set up SAS this way through a VPN then there's likely no method to have this accomplished. This assumes you're actually using a VPN and not just a Unix Server via FTP.

It requires the SAS administrator to set up the connection and to cross the VPN which is usually set up that way for a reason. 

You can create a file listing easily from your windows side and upload it though. 

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!
SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 5 replies
  • 533 views
  • 2 likes
  • 4 in conversation