BookmarkSubscribeRSS Feed
apple
Calcite | Level 5

Hi

I am a new user.

The directory address has been changed in this example. I can't import the data, below is the code I used and the error in the log. Please help. Thanks

data demographics;

infile 'C:\X\X\X\test.txt'; 

input Gender$ Age HH;

run;

ERROR: Physical file does not exist, C:\X\X\X\test.txt.

2 REPLIES 2
Jagadishkatam
Amethyst | Level 16

could you please check again if the file test.txt exits in the given path.

Thanks,

Jagadish

Thanks,
Jag
Patrick
Opal | Level 21

I assume you're running this code using SAS EG. If so then what you must be aware of is that SAS EG is a client which generates code and sends this code to a server (eg. SASApp) for execution. As the code actually executes on the server any file paths you define must be the file paths as the server sees it. So using c:\ is the c-drive on the server and not on your desktop and therefore something like 'C:\X\X\X\test.txt' looks for such a file on the server's C-drive where the file doesn't exist - though the error message.

What you need to do is either:

-  Save your file on a network drive which can also be accessed by the SAS Server (eg. using a UNC path like '\\server\x\x\x\test..txt')

- or use the EG import wizard under menu "file". This wizard runs on the client side (EG) and allows you to manually import the text file on your local c-drive

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!

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
  • 2 replies
  • 321 views
  • 1 like
  • 3 in conversation