Desktop productivity for business analysts and programmers

How to reference the embedded program from the egp

Reply
Occasional Contributor
Posts: 13

How to reference the embedded program from the egp

I have SASEGP1.egp, which has a few programs embedded in it.

For eg: program1, program2, program3 and program4 are embedded in SASSEGP1.egp. SAS server is install in UNIX.

How can I reference program2?

I tried %include 'program2.sas'; I got error that file doesn't exit in SASAPP location.

I don't want to save these embedded program into external location and than reference it.

eg: %include 'sample/code/program2.sas';

 

Can I reference the embedded program2 in program1 in the same EGP?

Super User
Posts: 9,868

Re: How to reference the embedded program from the egp

Since the code runs in the context of the workspace server, which may even be on a physically remote machine, it can not "read" from the project.

But you can conditionally connect nodes in the project flow.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Occasional Contributor
Posts: 13

Re: How to reference the embedded program from the egp

Posted in reply to KurtBremser

Thanks Kurt. Conditionally connecting the node didn't work for me.

I have a condition if its true than I want to run program2 and program4. If its false I want program 3 to run.

I applied the condition but all programs are running. I have created 2 separate process flow for time being.

Want to know if we can reference the embedded program.

Valued Guide
Posts: 515

Re: How to reference the embedded program from the egp

You can add condition to programs in process-flow. Referencing embedded programs is not possible.

Super User
Posts: 9,868

Re: How to reference the embedded program from the egp

[ Edited ]

@Ishaan wrote:

Thanks Kurt. Conditionally connecting the node didn't work for me.

I have a condition if its true than I want to run program2 and program4. If its false I want program 3 to run.

 


Example:

Program 1:

data _null_;
if weekday(today()) = 3
then call symput('continue','2');
else call symput('continue','3');
run;

%put &continue;

Program 2:

%put this is program 2;

Program 3:

%put this is program 3;

Program 2 and program 3 are both connected to program1, and both have a condition set for macrovariable &continue equals 2 or 3.

And this is the project log (don't mind the German messages):

27         data _null_;
28         if weekday(today()) = 3
29         then call symput('continue','2');
30         else call symput('continue','3');
31         run;

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

32         
33         %put &continue;
3
34         
35         GOPTIONS NOACCESSIBLE;
36         %LET _CLIENTTASKLABEL=;
37         %LET _CLIENTPROCESSFLOWNAME=;
38         %LET _CLIENTPROJECTPATH=;
39         %LET _CLIENTPROJECTPATHHOST=;
40         %LET _CLIENTPROJECTNAME=;
41         %LET _SASPROGRAMFILE=;
42         %LET _SASPROGRAMFILEHOST=;
43         
44         ;*';*";*/;quit;run;
45         ODS _ALL_ CLOSE;
46         
47         
48         QUIT; RUN;
49         
Log für "Bedingungsbewertung für Program_2." wurde bei 24.05.2018 12:05:14 auf XXXX ausgeführt
1          ;*';*";*/;quit;run;
2          OPTIONS PAGENO=MIN;
3          data _NULL_; rc = 0;
4          if &continue = 2 then
5             rc = 1;
6          CALL SYMPUT('_egrc', PUT(rc,1.));
7          stop;
8          run;

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

9          
10         QUIT; RUN;
11         
Log für "Bedingungsbewertung für Program_3." wurde bei 24.05.2018 12:05:15 auf XXXX ausgeführt
1          ;*';*";*/;quit;run;
2          OPTIONS PAGENO=MIN;
3          data _NULL_; rc = 0;
4          if &continue = 3 then
5             rc = 1;
6          CALL SYMPUT('_egrc', PUT(rc,1.));
7          stop;
8          run;

NOTE: DATA statement used (Total process time):
      real time           0.02 seconds
      cpu time            0.00 seconds
      

9          
10         QUIT; RUN;
11         
Log für "Program_3" wurde bei 24.05.2018 12:05:18 auf Allianz ausgeführt
1          ;*';*";*/;quit;run;
2          OPTIONS PAGENO=MIN;
3          %LET _CLIENTTASKLABEL='Program_3';
4          %LET _CLIENTPROCESSFLOWNAME='Prozessfluss';
5          %LET _CLIENTPROJECTPATH='';
6          %LET _CLIENTPROJECTPATHHOST='';
7          %LET _CLIENTPROJECTNAME='';
8          %LET _SASPROGRAMFILE='';
9          %LET _SASPROGRAMFILEHOST='';
10         
11         ODS _ALL_ CLOSE;
12         OPTIONS DEV=ACTIVEX;
13         GOPTIONS XPIXELS=0 YPIXELS=0;
14         ODS LISTING GPATH=&sasworklocation;
15         FILENAME EGSR TEMP;
16         ODS tagsets.sasreport13(ID=EGSR) FILE=EGSR
17             STYLE=Default
18             STYLESHEET=(URL="file:///C:/Program%20Files%20(x86)/SASHome/x86/SASEnterpriseGuide/7.1/Styles/Default.css")
19             NOGTITLE
20             NOGFOOTNOTE
21             GPATH=&sasworklocation
22             ENCODING=UTF8
23             options(rolap="on")
24         ;
NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR
25         
26         GOPTIONS ACCESSIBLE;
27         %put this is program 3;
this is program 3

You can see that nothing from program2 follows the condition evaluation for program 2, while program 3 has been executed.

 

Edit: X-ed out the App server names

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Super User
Posts: 3,855

Re: How to reference the embedded program from the egp

You need to export your programs out of your EG project and copy them to a server accessible folder for you to use %INCLUDE.

SAS Super FREQ
Posts: 391

Re: How to reference the embedded program from the egp

Since you can't use %include (since embedded programs -- no file for server to reference), rather than referencing Program2 in Program1, you could draw an explicit link (right-click Program2 and select Link to... or hover mouse on right side of Program2 node, click and drag link line to Program1) from Program2 to Program1.  For example:

explicit link.png

Then, whenever you run the project, process flow, or branch, Program2 will always run prior to Program1.

 

Casey

Ask a Question
Discussion stats
  • 6 replies
  • 196 views
  • 0 likes
  • 5 in conversation