Desktop productivity for business analysts and programmers

correct path for libname

Reply
New Contributor
Posts: 3

correct path for libname

I can connect to a specific .txt, .csv, or .xlsx in a network drive. What I cannot get SAS EG to do is just to connect to the drive and let me see what is in there. I have all the files I need in multiple subfolders that are zipped and what I want is to have my SAS EG connect to the drive so I can see all the subfolders from the tree and pick what I want to bring in as far as zipped and then pull out the .txt. I have overall 621 .txt files that will end up imported and we have tried every option to try and get this to work and this is like the last straw figuring out how to import all with SAS.

 

Right now I have this as my code and it says does not exist

LIBNAME MYCODE2 '\\networkdrive\folder\subfolder\';

 

If I point to an xlsx it gets right to it no errors

LIBNAME MYCODE2 PCFILES SERVER="&IP"

PATH='\\NETWORKDRIVE\FOLDER\SUBFOLDER\FILE.XLSX'

DBCOMMIT=0 READBUFF=500 INSERTBUFF=500;RUN;

 

 

Super User
Posts: 13,008

Re: correct path for libname

Posted in reply to tinamiller

When discussing errors post the code and the error message from the log. You may  have paraphrased the error message somewhat and there can be subtle differences in the meaning. Also many errors will indicate where in a line of code the error was detected. So it is best to post the log into a code box using the forum {i} icon as the main windows will reformat text.

 

 

As for your example, when you use PCFIles that instruction tells SAS to use additional tools and you pointed it to a specific file. TXT files are going to be much different.

 

What kind of information are you expecting SAS to tell you about TXT files?

New Contributor
Posts: 3

Re: correct path for libname

I have 15 subfolders on a shared drive. Within each folder is a zipped file. Within each zipped file are the .txt files. There are a total of 52 zipped files within all the 15 subfolders. Overall there are 621 .txt files. Each .txt file varies in regards to data elements and there are anywhere from 100 to 150 data elements depending on the file. I tried moving the files to my local and unzipping but must 1 zipped took 28 minutes to download. What I want to do is point my SAS EG to the shared and write code that loops through and unzips, extracts the .txt's I need. I am thinking SAS EG might not be a good tool for this and am looking at other options. Trying Visual Studio too.

Super User
Posts: 3,764

Re: correct path for libname

Posted in reply to tinamiller

Where is your EG SAS code running? It will either be running locally on your PC if you are using a local server connection or it will be running on a remote SAS application server (most likely). Your directory path looks OK, but the question is will it work from the remote SAS server? The easiest way to check this is to remotely logon to your SAS application server and try out the directory path in Windows Explorer if your remote SAS server runs on Windows. If your SAS server doesn't run on Windows then it gets more complicated to set up remote directory paths.

New Contributor
Posts: 3

Re: correct path for libname

That is the issue. SAS EG runs on a UNIX server.

Super User
Posts: 3,764

Re: correct path for libname

Posted in reply to tinamiller

Talk to your SAS / IT Admin about setting up a network file share on Unix that points to your file server folder. This isn't really a SAS issue it's a server setup issue. There are tools available on Unix for doing this but it depends whether your IT folks are willing to do it.

Ask a Question
Discussion stats
  • 5 replies
  • 140 views
  • 0 likes
  • 3 in conversation