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

I am using SAS Enterprise guide. SAS EG is running on a UNIX server, and I am using a Windows machine. I want to input files in SAS EG for an analysis using INFILE.

 

The file EXAMPLE.txt is saved on a windows shared drive, which is connected to a folder on the server running SAS EG. The path of EXAMPLE.TXT on the Windows Shared folder:

 

I:\projects\RWDS\rwds_1619\SASDATA

I can open EXAMPLE.TXT in SAS EG when I go

 

open - open data - Example.txt

 

The content of the file is displayed properly in the SAS Process Flow. The path on files on the server, which I can see on SAS EG, is:

 

W:\projects\RWDS\rwds_1619\SASDATA\EXAMPLE.TXT

When I try to input the files in SAS EG using INFILE command, I get this error:

 

ERROR: Physical file does not exist. /var/opt/teradata/sas/config/Lev1/SasApp/W:\projects\RWDS\rwds_1619\SASDATA\EXAMPLE.TXT

I used this code:

 

 

DATA MYDATA;
data new;
INFILE 'W:\projects\RWDS\rwds_1619\SASDATA\EXAMPLE.TXT';
INPUT ID $ 1-3 GP $ 5 AGE 6-9 TIME1 10-14 TIME2 15-19 TIME3 20-24;
PROC MEANS DATA=MYDATA;
RUN;
TITLE;FOOTNOTE

 

 

Expected result is to load the file EXAMPLE.TXT into SAS EG

 

Many thanks for your help!

1 ACCEPTED SOLUTION

Accepted Solutions
Patrick
Opal | Level 21

@Zipfer 

SAS EG is your client on your local Windows environment, your SAS Server which executes the SAS code is on a remote Unix machine.

Your file path is accessible in your client environment but not from your remote Unix environment and though any code that runs on the remote machine trying to use this client side path will fail.

It's possible to mount a "local" Windows path to a remote Unix server - but it's something your IT department often won't want to do.

 

If you've got EG then you can always use the import Wizard. SAS EG will then upload the data for you during execution time. There is also a copy to server task in EG which allows you to upload a text file from a local environment to a remote server.

 

Here detailed info very worth reading: https://blogs.sas.com/content/sasdummy/2017/12/12/import-text-data-sas-enterprise-guide/ 

View solution in original post

7 REPLIES 7
Tom
Super User Tom
Super User

Ask your support team to mount that shared folder onto the Unix machine were SAS is running. Then use the path to the file as Unix sees it.  So if I: on the Windows machine is mapped to \\server1\share1 then have the unix team mount that folder somewhere on unix. For example assume it is mounted as /windows/server1/share1.

Then your path on unix would be:

/windows/server1/share1/projects/RWDS/rwds_1619/SASDATA/EXAMPLE1.TXT

Remember that on Unix filenames are case sensitive, unlike on Windows.

 

Otherwise use an EG file copy task to upload the file first and read from where you uploaded it.

Zipfer
Calcite | Level 5

Thanks for your reply. I will try to contact  the support team next week. I have two add-on questions:

 

1. Still I wonder why I am able to open the file EXAMPLE.TXT when clicking "open - data", but not using the command infile. I can actually see the files on the specified path W:\..., which is the shared folder mounted on the server. Is there no way to tell the SAS command "infile" to use the same path that is displayed by clicking "open - data"?

 

2. I also tried the task - copy files solution. Here I get an error, because the specified target directory does not exist. I did not get an error for specifying the the path for the source files.

 

In SAS, I see in the lower left corner "Servers - SasApp - Home", and I generated the folder "training" (See screenshot). Do you know how to paste this folder "training" into the "Destination folder on SAS App" field that I find in the menu "Copy files ..."?

 

Again many thanks.

Tom
Super User Tom
Super User

Enterprise Guide is a Windows application that works as a GUI front end for developing and submitting SAS code to an actual copy of SAS running somewhere else. In your case the somewhere else is a Unix server.

 

In SAS/Studio you could click on the training folder and look at the properties to see what the actual path is. Not sure if that works in EG but there is probably some method to do that.

 

Normally on a Unix server you can reference your home directory by just use tilda, ~ , character.  So if the HOME folder you see in the EG GUI is actually the home directory for the user that is running the SAS code when try using this as the target path in your upload and your INFILE statement.

~/training/EXAMPLE1.TXT
Kurt_Bremser
Super User

UNIX does NOT have drive letters, so a path with W: at the front can never work as intended. Use UNIX filename syntax.

Ask your system admin for the proper UNIX path to the share.

Zipfer
Calcite | Level 5

Thany you very much for you support, I will ask for the UNIX path.

 

Michael

Patrick
Opal | Level 21

@Zipfer 

SAS EG is your client on your local Windows environment, your SAS Server which executes the SAS code is on a remote Unix machine.

Your file path is accessible in your client environment but not from your remote Unix environment and though any code that runs on the remote machine trying to use this client side path will fail.

It's possible to mount a "local" Windows path to a remote Unix server - but it's something your IT department often won't want to do.

 

If you've got EG then you can always use the import Wizard. SAS EG will then upload the data for you during execution time. There is also a copy to server task in EG which allows you to upload a text file from a local environment to a remote server.

 

Here detailed info very worth reading: https://blogs.sas.com/content/sasdummy/2017/12/12/import-text-data-sas-enterprise-guide/ 

Zipfer
Calcite | Level 5

Dear Patrick,

 

Thank you very much for your detailed explanation. I will now try the import wizard until I get the full unix path.

 

Michael

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