Is there a way to create an ordered list in code, rather than an EGP?

Accepted Solution Solved
Reply
Regular Contributor
Posts: 169
Accepted Solution

Is there a way to create an ordered list in code, rather than an EGP?

An ordered list is a nice way to get many code files to run, in a specified order, without running them individually. However, an Enterprise Guide Project file is a binary file, which is not ideal for committing to a repository. Is there a method to do this via code?

 

I know you can use call system or the X command, but if in Enterprise Guide, it may not be clear where the server stores the code. Is there a way to run a code file with a relative path (like ./file on Linux) so SAS knows to look in the same folder?


Accepted Solutions
Solution
‎10-04-2016 11:57 AM
SAS Super FREQ
Posts: 3,620

Re: Is there a way to create an ordered list in code, rather than an EGP?

Do you know about the %INCUDE statement? You can use it to include other source files. 

You can do something like this:

 

%let SrcDir = "U:\Programs\src"; 

%include "&SrcDir\Pgm1.sas";

%include "&SrcDir\Pgm2.sas";

...

View solution in original post


All Replies
Solution
‎10-04-2016 11:57 AM
SAS Super FREQ
Posts: 3,620

Re: Is there a way to create an ordered list in code, rather than an EGP?

Do you know about the %INCUDE statement? You can use it to include other source files. 

You can do something like this:

 

%let SrcDir = "U:\Programs\src"; 

%include "&SrcDir\Pgm1.sas";

%include "&SrcDir\Pgm2.sas";

...

Regular Contributor
Posts: 169

Re: Is there a way to create an ordered list in code, rather than an EGP?

Thanks for the reply Rick, but the same problem applies as for call system or the X statement. How can I get the path if SAS EG is running on a server? It doesn't use a local system path, and I don't necessarily know where the code will be if a different user runs it. Is there a method of using a relative path?

SAS Super FREQ
Posts: 3,620

Re: Is there a way to create an ordered list in code, rather than an EGP?

Sorry, I don't think I understood your configuration. So you want to run the code in EG, which is connected to a SAS server.  Where are the programs located? On the client PC?

Regular Contributor
Posts: 169

Re: Is there a way to create an ordered list in code, rather than an EGP?

For testing, they may be on the developer's PC. For best coding practice, I'd like the code to not care where it is located. Is there a way to %INCLUDE a relative path?

 

Using those last few words as search terms, I was able to find an answer via this similar question: "I think you are looking for the automatic SAS variables SAS_EXECFILEPATH and SAS_EXECFILENAME."

 

I will mark your first response as an answer, because %INCLUDE allows for running other code files in the order you specify. Thank you for your help and discussion!

☑ This topic is solved.

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

Discussion stats
  • 4 replies
  • 364 views
  • 0 likes
  • 2 in conversation