ERROR: Physical file does not exist

Accepted Solution Solved
Reply
New Contributor
Posts: 3
Accepted Solution

ERROR: Physical file does not exist

Hi,

This is my first post.  I have searched for this error on these boards, but the solutions I am finding do not seem to specifically solve my issue.  I am using Ron Cody's book "Learning SAS by Example."  I created a virtual box on my machine and I access SAS University Edition through the localhost:10080 address.  In the material, Ron has supplied two files, mydata.csv and mydata.txt.  They are the same information inside, one is just comma delimited and the other is space delimited.  I am trying to use the filename statement to alias a file.  I am getting an error in response.

 

This statement works just fine to read the file:

 

data Demographics;


infile "/folders/myfolders/sasuser.v94/mydata.csv" dsd;


input Gender $ Age Height Weight;


run;

This statement, however, does not:

 

filename testalias "/folders/myfolders/sasuser.v94/mydata.csv";

data Demographics; 

infile testalias dsd;

input Gender $ Age Height Weight;

run; 

When I run the second program, I get the following error:

ERROR: Physical file does not exist, /opt/sasinside/SASConfig/Lev1/SASApp/TESTALIAS

 

I am assuming there is something about the filename statement that I am not understanding, but I haven't been able to find a good answer online.

 

Let me know,

 

Adam


Accepted Solutions
Solution
‎05-05-2018 09:31 AM
Super User
Posts: 6,753

Re: ERROR: Physical file does not exist

"testalias" contains 9 characters.  You are limited to 8 characters for the name in the FILENAME statement.

View solution in original post


All Replies
Super User
Posts: 23,675

Re: ERROR: Physical file does not exist

Post your log from both sets of code please. 

I would expect to see an error on your filename statement. 


@ahosey01 wrote:

Hi,

This is my first post.  I have searched for this error on these boards, but the solutions I am finding do not seem to specifically solve my issue.  I am using Ron Cody's book "Learning SAS by Example."  I created a virtual box on my machine and I access SAS University Edition through the localhost:10080 address.  In the material, Ron has supplied two files, mydata.csv and mydata.txt.  They are the same information inside, one is just comma delimited and the other is space delimited.  I am trying to use the filename statement to alias a file.  I am getting an error in response.

 

This statement works just fine to read the file:

 

data Demographics;


infile "/folders/myfolders/sasuser.v94/mydata.csv" dsd;


input Gender $ Age Height Weight;


run;

This statement, however, does not:

 

filename testalias "/folders/myfolders/sasuser.v94/mydata.csv";

data Demographics; 

infile testalias dsd;

input Gender $ Age Height Weight;

run; 

When I run the second program, I get the following error:

ERROR: Physical file does not exist, /opt/sasinside/SASConfig/Lev1/SASApp/TESTALIAS

 

I am assuming there is something about the filename statement that I am not understanding, but I haven't been able to find a good answer online.

 

Let me know,

 

Adam


 

 

New Contributor
Posts: 3

Re: ERROR: Physical file does not exist

Here is the log containing the error: 

 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 72         
 73         filename testalias "/folders/myfolders/sasuser.v94/mydata.csv";
 ERROR: Invalid logical name.
 ERROR: Error in the FILENAME statement.
 74         
 75         data Demographics;
 76         
 77         infile testalias dsd;
 78         
 79         input Gender $ Age Height Weight;
 80         
 81         run;
 
 ERROR: Physical file does not exist, /opt/sasinside/SASConfig/Lev1/SASApp/TESTALIAS.
 NOTE: The SAS System stopped processing this step because of errors.
 WARNING: The data set WORK.DEMOGRAPHICS may be incomplete.  When this step was stopped there were 0 observations and 4 variables.
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds

 

Here is the log from the program that runs fine:

 

1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 72         
 73         data Demographics;
 74         
 75         infile "/folders/myfolders/sasuser.v94/mydata.csv" dsd;
 76         
 77         input Gender $ Age Height Weight;
 78         
 79         run;
 
 NOTE: The infile "/folders/myfolders/sasuser.v94/mydata.csv" is:
       Filename=/folders/myfolders/sasuser.v94/mydata.csv,
       Owner Name=sasdemo,Group Name=sas,
       Access Permission=-rw-rw-r--,
       Last Modified=04May2018:21:29:28,
       File Size (bytes)=73
 
 NOTE: 5 records were read from the infile "/folders/myfolders/sasuser.v94/mydata.csv".
       The minimum record length was 13.
       The maximum record length was 13.
 NOTE: The data set WORK.DEMOGRAPHICS has 5 observations and 4 variables.
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 80         
Super User
Posts: 10,211

Re: ERROR: Physical file does not exist

NEVER, EVER start fixing ERRORs from the bottom up. Fix the first ERROR in the log first, then see how much this helped, and then tackle the next one (if there's one left at all).

 

In your case, fixing the logical name problem will automatically fix everything else.

 

Also note the importance of posting the whole log.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
New Contributor
Posts: 3

Re: ERROR: Physical file does not exist

Posted in reply to KurtBremser

I am so new to this that I didn't even realize 'invalid logical name' was referring to the character length.  My only exposure to programming has been to write CL programs on the i Series and errors containing the word 'logical' mean something totally different - my presumption (obviously incorrecty) was that the error was based on the path through which the SAS program was accessing the file.  This makes a lot of sense, thanks everyone.

 

Adam

Solution
‎05-05-2018 09:31 AM
Super User
Posts: 6,753

Re: ERROR: Physical file does not exist

"testalias" contains 9 characters.  You are limited to 8 characters for the name in the FILENAME statement.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 206 views
  • 0 likes
  • 4 in conversation