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

Hi,

 

I am trying to refer SAS codes in %INCLUDE statement for SAS codes on my local machine. I am following the below steps suggested:

 

This setting is maintained per project. To set it:
1.Select File->Project Properties. The Properties window appears.
2.Select the File References tab.
3.Check the box: "Use paths relative to the project for programs and importable files"

I am creating tow SAS codes as:

1.  h:\test\outer.sas

%put outer;

%include "inner.sas";

2. h:\test\inner.sas

%put inner;

 

NOTE: I have also tried saving the Project in the same directory (h:\test)

 

when I execute the SAS code I get the below error:

 

WARNING: Physical file does not exist, /var/applications/sas/config94/Lev1/SASApp/inner.sas.

ERROR: Cannot open %INCLUDE file inner.sas.

 

Can someone help me understand what I am missing to provide the relative path reference?

 

Thanks

Ved Agrawal

1 ACCEPTED SOLUTION

Accepted Solutions
BrunoMueller
SAS Super FREQ

The %INCLUDE statement runs on the SAS server and has therefor no knowledge of files on your local machine where the SAS Enterprise Guide runs.

 

I see two ways to do this:

  1. Add your local code to the processflow, as you do with other code and link the programs in your processflow. Use the RightMouseButton and select "Link Program to ..." to draw the connection
  2. Use the "Copy File" Task to copy the .sas files from your local machine to the SAS server, see here for more information https://blogs.sas.com/content/sasdummy/2016/11/14/copy-files-task-moved-menus/

 

 

View solution in original post

7 REPLIES 7
Reeza
Super User

Where are you saving your EGP files?

and what are you expecting the PUT statement to do in that code?

Ved_Agrawal
Fluorite | Level 6

in the same location as the codes are.

 

Ved_Agrawal
Fluorite | Level 6

From the Put code I just want to understand if I can get in to the inner.sas code.

Reeza
Super User

@Ved_Agrawal wrote:

From the Put code I just want to understand if I can get in to the inner.sas code.


No, %include runs the code in the program inner. 

 

I suspect this this is because SAS is actually on the server, not locally. If you can’t run EG locally, I don’t know if this approach will work. 

Ved_Agrawal
Fluorite | Level 6
Yes the SAS is on our serve, but in order to implement Local repository we need to keep all our codes on local server and run it on our remote servers.
I was reading the community space for this issue and there are suggestion of using proc upload for that case, but I wanted to avoid its usage and want to make use of relative SAS paths.
BrunoMueller
SAS Super FREQ

The %INCLUDE statement runs on the SAS server and has therefor no knowledge of files on your local machine where the SAS Enterprise Guide runs.

 

I see two ways to do this:

  1. Add your local code to the processflow, as you do with other code and link the programs in your processflow. Use the RightMouseButton and select "Link Program to ..." to draw the connection
  2. Use the "Copy File" Task to copy the .sas files from your local machine to the SAS server, see here for more information https://blogs.sas.com/content/sasdummy/2016/11/14/copy-files-task-moved-menus/

 

 

Ved_Agrawal
Fluorite | Level 6

Thanks for the solution. Actually I was foolish to try include one SAS code into another, where as SAS EG provides use of Flow for this.

without include it can be simply done as you suggested "Add your local code to the processflow, as you do with other code and link the programs in your processflow. Use the RightMouseButton and select "Link Program to ..." to draw the connection"

 

Regards

Ved Agrawal

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 7 replies
  • 4879 views
  • 3 likes
  • 3 in conversation