I am trying to use an %INCLUDE statement on Linux with an uppercase pathname (which is forced on me, because all user directories start like this). I keep getting "WARNING: Physical file does not exist, '/server1/home/ms/userx/file.txt'. ERROR: Cannot open %INCLUDE file INCL1.", so I assume the problem is with the uppercase pathname, I thought from the documentation that this should be fine if I use quotation marks (I also tried "..." instead of '...' - what I do below works in an interactive session using "...", but not '...', but somehow in batch mode neither seems to work). Or is it something else that I am doing wrong??
My code is something like
%macro test(a);
filename incl1 '/SERVER1/home/ms/userx/file.txt';
proc iml; %include inc1; quit;
%mend;
%test(a=1);
and I also tried
%macro test(a);
proc iml; %include '/SERVER1/home/ms/userx/file.txt'; quit;
%mend;
%test(a=1);
I cannot really get around using an include statement, because I need to use a submit statement in PROC IML in order to run some R code via PROC IML (and it appears I cannot have my submit/endsubmit code inside a macro, which this needs to be embedden in for some other reasons to do with parallelizing some simulations). The content of file.txt is some R code plus the submit/endsubmit statements, say:
submit / R; abc <- 1:15 endsubmit;
Are you 100% sure that this file exists with your spelling/casing?
And the user that executes the SAS program has access?
Just to rule out the possibility of that is the error message that change the case, not the filename/%include...
Have you tried other files/locations?
Can you use ~ to represent /home/username/
%inc '~/file.txt';
Thanks, using "~..." was a great suggestion. That worked and solved my very specific problem, I guess a more general answer would be useful for the future, too, but I will accept this as the solution for my current problem.
Can you run some Unix commands from SAS to see what is going on?
data _null_;
input cmd $80. ;
infile cmd pipe filevar=cmd end=eof;
put cmd=;
do while (not eof);
input ;
put _infile_;
end;
cards;
pwd
ls -ld ~
ls -ld /server1/home
ls -ld /SERVER1/home
;;;;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.