BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
jon8
Obsidian | Level 7

Hey!

 

I just started an internship and I have to code on SAS. But I have two problems that i didn't heard about on the internet and may be connected to my company network when I try to launch that test script:

 

DATA WORK.test;

INFILE "C:\Users\Documents\test.txt";

INPUT Column1 Column2;

RUN;

 

The first one is that error:

ERROR: Physical file does not exist, /opt/sas/config/Lev1/SASApp/C:\Users\Documents\test.txt.

I don't know why the root "/opt/sas/config/Lev1/SASApp/" is there and am I the only one to have that error? I didn't saw it anywhere.

 

So I have been told to put an 'n' after the path (nobody knows why) just like that:

DATA WORK.test;

INFILE "C:\Users\Documents\test.txt"n;

INPUT Column1 Column2;

RUN;

 

And now the error is:

 

ERROR 22-322: Syntax error, expecting one of the following: String, Quoted Chain. 

ERROR 200-322: The symbol is not recognized and will be ignored.

 

What's wrong with the code? 

 

I would really appreciate someone to help me with that case because I'm block if I can't even import a table.

Thanks a lot.

Have a good day!

 

PS: I'm on 7.1 Version

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

Your SAS ... most likely SAS Studio ...  is running on a server and it cannot access files on your computer's C: drive. The file has to be uploaded to the server first, and then accessed via the proper INFILE statement using the server location of the file.

 

Something like this:

 

infile "/opt/sas/config/Lev1/SASApp/test.txt";

 

but of course, you must use the exact server folder name and what I gave in the example may not be right.

--
Paige Miller

View solution in original post

18 REPLIES 18
PaigeMiller
Diamond | Level 26

Your SAS ... most likely SAS Studio ...  is running on a server and it cannot access files on your computer's C: drive. The file has to be uploaded to the server first, and then accessed via the proper INFILE statement using the server location of the file.

 

Something like this:

 

infile "/opt/sas/config/Lev1/SASApp/test.txt";

 

but of course, you must use the exact server folder name and what I gave in the example may not be right.

--
Paige Miller
jon8
Obsidian | Level 7

First thanks,

 

But, just by importing CSV files (File>New>Data>...) I can access to my computer's C: drive. Why can I reach it out in that case ?

 

Thanks 

jon8
Obsidian | Level 7
And also why in the second case have I a Syntax Error ?
Thanks a lot
PaigeMiller
Diamond | Level 26

@jon8 wrote:
And also why in the second case have I a Syntax Error ?
Thanks a lot

Second case is not valid syntax. You can't use anything that looks like

 

infile "C:\Users\Documents...

 

and get it to work from SAS on a server.

--
Paige Miller
jon8
Obsidian | Level 7
Okay

It’s getting clearer for me !
Have a nice week-end!
PaigeMiller
Diamond | Level 26

@jon8 wrote:

First thanks,

 

But, just by importing CSV files (File>New>Data>...) I can access to my computer's C: drive. Why can I reach it out in that case ?


Ok, first let's establish what SAS interface are you using. Are you using SAS Studio, or something else? If you're not sure, show us a screen capture (click on the "Insert Photos" icon, do not attach files).

 

 

--
Paige Miller
jon8
Obsidian | Level 7
[image0.jpeg]
Does that image helps you ?
PaigeMiller
Diamond | Level 26

Repeating: click on the "Insert Photos" icon

--
Paige Miller
PaigeMiller
Diamond | Level 26

You did not click on the "Insert Photos" icon. 

 

I never download attachments, so please click on the "Insert Photos" icon.

--
Paige Miller
PaigeMiller
Diamond | Level 26

Thanks. I am not all that familiar with how Enterprise Guide interacts with your Windows file system. I think others (perhaps @ChrisHemedinger ) can give a better explanation.

--
Paige Miller
jon8
Obsidian | Level 7
Okay Thanks a lot.
So i Hope he will be able to help me.
Have a good day
ChrisHemedinger
Community Manager

While SAS Enterprise Guide runs on your local Windows machine, your SAS session is remote (on Linux, most likely) and cannot "see" your local C: drive. So you cannot use SAS syntax to reach your local files on your C drive.

 

Instead, you must place the data file in a location where your SAS session can read it. For some users that might be on a shared network location that can be accessed by both Windows and Linux -- if you're lucky to have a setup like that in your org. We do here. For example:

  • Windows: \\netshare\user\myid\data.csv
  • Linux (and for SAS): /u/myid/data.csv

If you don't have that, you can use the Copy Files task in SAS Enterprise Guide to copy the local data file from SAS to a known location on your remote SAS session. That step can be captured as part of your process flow in a project. I have a video tutorial for this here.

 

Learn from the Experts! Check out the huge catalog of free sessions in the Ask the Expert webinar series.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 18 replies
  • 3584 views
  • 4 likes
  • 4 in conversation