SAS macro for conditional execute

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 12
Accepted Solution

SAS macro for conditional execute

I have a project in EG with half a dozen or so programs.  For one of these programs I want to include a macro which checks the value of a macro variable (FY), so that the program runs if &FY = 2013.  If it isn't it skips this program and continues to the next program in the process flow. 


Accepted Solutions
Solution
‎10-28-2014 08:47 AM
Esteemed Advisor
Posts: 6,646

Re: SAS macro for conditional execute

You can insert the follownig code:

at the beginning of the program:

%macro execute_program;

%if "&fy" = "2013" %then %do;

at the end of the program:

%end;

%mend;

%execute_program;

or you can use a condition in the process flow in Enterprise Guide (right click on the program, Condition - Add)

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers

View solution in original post


All Replies
Solution
‎10-28-2014 08:47 AM
Esteemed Advisor
Posts: 6,646

Re: SAS macro for conditional execute

You can insert the follownig code:

at the beginning of the program:

%macro execute_program;

%if "&fy" = "2013" %then %do;

at the end of the program:

%end;

%mend;

%execute_program;

or you can use a condition in the process flow in Enterprise Guide (right click on the program, Condition - Add)

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 12

Re: SAS macro for conditional execute

that worked.  Thanks

☑ This topic is SOLVED.

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

Discussion stats
  • 2 replies
  • 150 views
  • 0 likes
  • 2 in conversation