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

 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;
1 ACCEPTED SOLUTION

Accepted Solutions
data_null__
Jade | Level 19

Can you use ~ to represent /home/username/

 

%inc '~/file.txt';

View solution in original post

4 REPLIES 4
LinusH
Tourmaline | Level 20

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?

Data never sleeps
data_null__
Jade | Level 19

Can you use ~ to represent /home/username/

 

%inc '~/file.txt';
BjoernHolzhauer
Obsidian | Level 7

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.

Tom
Super User Tom
Super User

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
;;;;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 4 replies
  • 1566 views
  • 1 like
  • 4 in conversation