Having an infile statement problem

Reply
N/A
Posts: 1

Having an infile statement problem

Here's the cod:

data work.newsalesemps;

  length First_Name $ 12 Last_Name $ 18 Job_Title $ 25;

  infile 'newsalesemps.csv';

  input First_Name $ Last_Name $ Job_Title $ Salary;

run;

title 'New Sales Employees';

proc print data=work.newsalesemps;

run;

proc means data=work.newsalesemps;

  class Job_Title;

  var Salary;

run;

title;

So the main error I'm getting here is that the physical file does not exist. I'm on SAS Enterprise Guide and so I've discovered that the program itself cannot access my comps C or D drive which makes downloading orion onto my comp no kind of a solution. I'm wondering if we need to even bother with the infile since it seems mainly to be used to reference a physical pathway on my actual computer. Am I looking at this the wrong way or have I missed something? Any help would be appreciated.

Super Contributor
Posts: 297

Re: Having an infile statement problem

Are you running SAS on your local machine or on a server?

If you are running on a server then your code is attempting to access the CSV on the servers default location. 

Copy the file to a network drive that SAS has access to, alter your code to reflect this and run it again.

Hopefully that will do the trick.

Super User
Posts: 6,938

Re: Having an infile statement problem

With EG, you most probably have the SAS system itself running on a server. If you specifiy a relative path (something that does not start with X:\ on windows or / on UNIX), SAS will look in the current working directory it was started in, so it will not find the file in most cases.

In order to get a valid infile, you must

- find out what type of server you have

- copy the file to the server or to a network location that the server (and your acoount on the server!) has access to

- use the correct naming conventions when specifying the absolute(!) path to the file

If your EG is a frontend for a local SAS installation on your PC, simply put the file in a location that's easy to find (like C:\TEMP), and then use 'C:\TEMP\newsalesemps.csv' in your filename or infile statement.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Ask a Question
Discussion stats
  • 2 replies
  • 341 views
  • 0 likes
  • 3 in conversation