7

Is there any macro command that allows calling one program from another (the %run_program() pseudo code)?

Program "Settings":

%let myvar="HELLO WORLD!";

Program "Program":

%run_program(Settings); *Pseudo-code;
%put &myvar; *Should print *Should print "HELLO WORLD!";

Overview

D. Josefsson
  • 1,052
  • 7
  • 21
Adam Ryczkowski
  • 7,592
  • 13
  • 42
  • 68

3 Answers3

4

This is not exact answer on your question, but if you only want to be sure that Settings is run before Program when Run Process Flow you can link them together.

  1. Right click Settings,
  2. choose Link Settings to...,
  3. and pick Program from the dialog.
  4. Run Process FLow And see the Hello World be printed in the log.
D. Josefsson
  • 1,052
  • 7
  • 21
  • 1
    This is probably the most "enterprise guide" solution, as long as you can tolerate the intricacies of process flows. You also can simply run the process flow _without_ linking them, and as long as they're in the proper order on the flow page (NOT the project tree, that order is irrelevant - the right side one is what matters), they'll run in the right order. – Joe Apr 17 '15 at 14:09
2

I think that you are looking for the %include function.

You would have to save 'Settings' as a stand-alone program on your server like '/myserver/somefolder/settings.sas'.

Then you could ensure that it is run via:

...some code
%include ('/myserver/somefolder/settings.sas');
... more code

The program would run exactly as it would if you copy-pasted the contents of 'settings.sas' into the current program.

Tim Sands
  • 948
  • 4
  • 8
  • 1
    This isn't really the Enterprise Guide Project solution, though it would work if you are using EG as if it were local base SAS. – Joe Apr 17 '15 at 14:06
2

In addition to the Process Flow, you also can create an Ordered List. This allows you to run programs in a single process flow in multiple different orders (or run a subset of a process flow).

You create that in New -> Ordered List, then Add programs to it, move them up/down in the order you want. Then you see the ordered list on the left in the project tree and can right click to run it (or select then F8).

There is not a macro command to run a program in enterprise guide; you can use automation via .NET if you want to do things like that. Chris Hemedinger on The SAS Dummy has a good article on EG automation.

Joe
  • 62,789
  • 6
  • 49
  • 67