BookmarkSubscribeRSS Feed
agCA
Calcite | Level 5

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.

2 REPLIES 2
Scott_Mitchell
Quartz | Level 8

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.

Kurt_Bremser
Super User

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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