BookmarkSubscribeRSS Feed
subash8654
Calcite | Level 5

I am a new SAS user, I have been trying to enter some values into one output file. But I keep getting the error

ERROR: Physical file does not exist

In fact I even copied the location of the work folder and created a txt file there, still I get the same error.

Please pour in suggestions

 

12 REPLIES 12
Tom
Super User Tom
Super User

We cannot help if you do not show us the code.

Use the Insert Code icon (looks like < / > ) to get a pop-up window where you can paste the lines from the SAS log that shows how you are trying to READ from the file.

subash8654
Calcite | Level 5
proc import datafile='X:\Files\Users\XXXX\SAS\Sample.txt'
            out=Inputs
            dbms=dlm
            replace;
	    delimiter='09'x;
run;

proc print data=Work.Inputs;
run;

%sysfunc(pathname(work))\Inputs.txt %sysfunc(fexist(pathname(work)))\Output.txt);

I tried to take data from a tab delimited text file. trying to read/ create  input and output txt file in work folder.This is where I get the error. The output data returns the input from the above code, but gives this error for output

ERROR: Physical file does not exist, F:\SASWORK\_TD25664_VIRTAPP-PVSC49_\Prc2\Output.txt.

subash8654
Calcite | Level 5

Actually I am not getting a problem/error in Proc IMport step.

after that I use a %tslit command

Since for confidential purpose, I cant share which file I am using but the complete structure is as follows

proc import datafile='X:\Files\Users\60135553\SAS\Sample.txt'
            out=Inputs
            dbms=dlm
            replace;
		    delimiter='09'x;
run;

proc print data=Work.Inputs;
run;

followed by

x %tslit("Location.exe" location.grm %sysfunc(pathname(work))\Inputs.txt %sysfunc(pathname(work))\Output.txt);

data dd_xx;
  length Primary_Key $36
             phn_name $50
         phn_code $6
         gifFlags $20;
  infile "%sysfunc(pathname(work))\Output.txt" dlm='09'x dsd;
  input Primary_Key $
        sa1_2021_code $
        sa1_2016_code $
        phn_name $
        phn_code $
        gifFlags  $;
run;
Kurt_Bremser
Super User

Instead of using the X statement, use the FILENAME PIPE method to run external commands:

data _null_;
infile "Location.exe location.grm %sysfunc(pathname(work))\Inputs.txt %sysfunc(pathname(work))\Output.txt 2>&1" pipe;
input;
put _infile_;
run;

You will find all diagnostic messages returned from the command in the SAS log.

subash8654
Calcite | Level 5
Still I get the error

ERROR: Physical file does not exist, F:\SASWORK\_TD26236_VIRTAPP-PVSC50_\Prc2\Output.txt).
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.OUTPUT_INTECH may be incomplete. When this step was stopped there were 0 observations and 20 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.01 seconds
Tom
Super User Tom
Super User

That error message is different than the one you posted earlier.

It is saying that it cannot find a file whose name ends in a right parentheses.

If you tried to generate the name using some function call you appear to have an extra ) in your code.

To really tell we need to see the whole log, not just the error message.

And please remember to use the Insert Code button (looks like < / > ) to get a pop-up window were you can paste the text. That way the spacing is not modified by the web page trying to flow the text into paragraphs.

Tom
Super User Tom
Super User

The top of that program looks find.  What does the LOG say when you run it?

 

That last line is gibberish.  Why do you have that line? What are your trying to do with it?

subash8654
Calcite | Level 5

Please refer to my code above in the reply

 

ERROR: Physical file does not exist, F:\SASWORK\_TD28280_VIRTAPP-PVSC49_\Prc2\Output.txt.

 

I get this in the log

Patrick
Opal | Level 21

We can't know what below highlighted bits are supposed to do and if this is even valid syntax. 

Patrick_0-1693459819037.png

 

The log tells you that ....\Output.txt doesn't exist. Based on the code you share you appear to believe the x command creates the file but then SAS clearly tells you that this is not the case. 

May-be run your command first via a command prompt on some file in a permanent location and make sure this works.

 

ballardw
Super User

Open Windows explorer.

Navigate to F:\SASWORK\_TD28280_VIRTAPP-PVSC49_\Prc2

Show a screen capture of the files in that folder.

 

 

Tom
Super User Tom
Super User

If you want make a temporary file then use the TEMP engine in a FILENAME statement.

filename output temp;

proc export data=sashelp.class dbms=csv file=output ;
run;

If there is some reason that you need to give a special name to the temporary file than you can get the location of the WORK directory using %SYSFUNC(PATHNAME(WORK)).

filename output "%sysfunc(pathname(work))/output.txt";

 

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!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 12 replies
  • 2541 views
  • 0 likes
  • 5 in conversation