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

Hello,

 

Could you please help me with next item?

 

I'm trying to read a very simple dataset, however, I'm getting an error in the log and program is not being executed:

 

Dataset:

 

Raul 8
Rodo 9
Carl 10
Pedr 7

 

Program:

 

filename grade "C:\Users\DELL\Desktop\Length1.txt";

 

data grade_cat;
         infile grade;
         input Name Grade;
run;

 

proc print data=grade_cat;
run;

 

Error:

 

ERROR: Physical file does not exist, C:\Users\DELL\Desktop\Length1.txt.

 

The situation is that file indeed exist in this path, there are NOT:

-spelling issues

-path name issues

 

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

You have a file in that directory named LENGTH1.DAT

 

Your code refers to a file named LENGTH1.TXT

--
Paige Miller

View solution in original post

13 REPLIES 13
VDD
Ammonite | Level 13 VDD
Ammonite | Level 13

try this


 
data grade_cat;
         infile "C:\Users\DELL\Desktop\Length1.txt";
         input Name Grade;
run;
 
proc print data=grade_cat;
run;
rodolfo_1
Fluorite | Level 6

Hi,

 

This was one of the first things I tried, but the error is the same 😞

Patrick
Opal | Level 21

SAS only throws this error if the file really isn't accessible to SAS because it doesn't exist at all or because the user under which SAS runs doesn't have access to the file (so can't "see" it).

 

Please keep in mind that you need to use a path as "seen" from the server where SAS executes. If you don't have a local installation of SAS then a path on your local machine will most likely not be accessible from the server where SAS executes - or at least will look different (so not C:\Users\DELL\Desktop\...).

rodolfo_1
Fluorite | Level 6
Thank you for your reply, however, I do have SAS 9.4 instaled in my lap, and file exist (I'm seeing it) in the path.
Tom
Super User Tom
Super User

@rodolfo_1 wrote:
Thank you for your reply, however, I do have SAS 9.4 instaled in my lap, and file exist (I'm seeing it) in the path.

There are ways for the name of the file to be different than it appears. For example of the name of the file has a trailing blank space then you might not notice it by just looking at a directory listing or Windows Explorer window.

 

Run the diagnostic test code that others have posted.  If you cannot figure out the answer then post the results of those tests.

 

ChrisNZ
Tourmaline | Level 20

You can run

filename DIR pipe 'dir c:\Users\DELL\Desktop';
data _null_;
  infile DIR; 
  input;
  put _infile_;
run;

to see what SAS sees (provided you are allowed to access the OS command line from SAS).

The likely reason for your issue is that you are confusing which machine SAS runs on vs where the file is located.

 

rodolfo_1
Fluorite | Level 6

This si the log what I getting after run this code:

 

14 filename DIR pipe 'dir c:\Users\DELL\Desktop';
15 data _null_;
16 infile DIR;
17 input;
18 put _infile_;
19 run;

NOTE: The infile DIR is:
Unnamed Pipe Access Device,
PROCESS=dir c:\Users\DELL\Desktop,RECFM=V,
LRECL=32767

El volumen de la unidad C no tiene etiqueta.
El n£mero de serie del volumen es: 1CA4-B67D

Directorio de c:\Users\DELL\Desktop

15/03/2018 12:00 a. m. <DIR> .
15/03/2018 12:00 a. m. <DIR> ..
12/02/2019 09:46 p. m. <DIR> Coursera
15/03/2019 10:48 p. m. <DIR> Docs
05/02/2019 09:43 p. m. <DIR> INC_Info
16/03/2019 06:30 p. m. 31 Length1.DAT
10/11/2018 10:53 p. m. 1,417 Microsoft Edge.lnk
05/02/2019 09:43 p. m. <DIR> Project_management
05/02/2019 09:43 p. m. <DIR> R
10/11/2018 11:25 p. m. 1,124 R x64 3.5.1.lnk
10/11/2018 11:51 p. m. 941 RStudio.lnk
15/03/2019 10:42 p. m. <DIR> SAS
10/11/2018 11:15 p. m. 2,052 SAS_9.4.lnk
05/02/2019 09:43 p. m. <DIR> Statistic
05/02/2019 09:43 p. m. <DIR> UOC
05/02/2019 09:43 p. m. <DIR> VBA
5 archivos 5,565 bytes
11 dirs 188,154,019,840 bytes libres
NOTE: 23 records were read from the infile DIR.
The minimum record length was 0.
The maximum record length was 60.
NOTE: DATA statement used (Total process time):
real time 0.26 seconds
cpu time 0.09 seconds

PaigeMiller
Diamond | Level 26

You have a file in that directory named LENGTH1.DAT

 

Your code refers to a file named LENGTH1.TXT

--
Paige Miller
rodolfo_1
Fluorite | Level 6
Thank you :), that's right, I do not know why the extention of the file 'LENGTH1' was saved as .DAT if I created it openning a notepad and saving it as alwas in the desktop, I've learned something now today.
Tom
Super User Tom
Super User

Windows Explorer has a nasty habit of not displaying the extension on filenames. There are ways to turn off that horrible feature.

ballardw
Super User

@Tom wrote:

Windows Explorer has a nasty habit of not displaying the extension on filenames. There are ways to turn off that horrible feature.


One of the very first things I do when I get a new windows box: Turn on file extensions in Windows Explorer or any other file viewing program.

 

In some dialog boxes you might have to do a "show all files" as some will assume (often incorrectly) what file type you may be looking for.

Kurt_Bremser
Super User

This is usually a context issue. Your SAS session runs in a different context than Windows Explorer. This may be a different machine (if SAS is installed on a server), or a different user-ID (eg pooled workspace server), or something caused by Windows peculiarities (SAS started by the object spawner runs in "batch mode" vs the "desktop mode" you are used to).

 

So you need to view your problem in light of this. Are you using SAS Studio, Enterprise Guide, or the Display Manager of Base SAS?

rodolfo_1
Fluorite | Level 6
I'm using SAS 9.4 installed in my lap

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 13 replies
  • 21728 views
  • 6 likes
  • 8 in conversation