BookmarkSubscribeRSS Feed
tinamiller
Calcite | Level 5

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;

 

 

5 REPLIES 5
ballardw
Super User

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?

tinamiller
Calcite | Level 5

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.

SASKiwi
PROC Star

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.

tinamiller
Calcite | Level 5

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

SASKiwi
PROC Star

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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 1639 views
  • 0 likes
  • 3 in conversation