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.
You have a file in that directory named LENGTH1.DAT
Your code refers to a file named LENGTH1.TXT
try this
data grade_cat;
infile "C:\Users\DELL\Desktop\Length1.txt";
input Name Grade;
run;
proc print data=grade_cat;
run;
Hi,
This was one of the first things I tried, but the error is the same 😞
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 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.
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.
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
You have a file in that directory named LENGTH1.DAT
Your code refers to a file named LENGTH1.TXT
Windows Explorer has a nasty habit of not displaying the extension on filenames. There are ways to turn off that horrible feature.
@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.
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?
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.