Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to call one macro program from another in SAS Enterprise Guide?

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

like image 283
Adam Ryczkowski Avatar asked Apr 17 '15 10:04

Adam Ryczkowski


People also ask

Can you call a macro within a macro SAS?

You can call a macro within a macro. Here is a trivial example. %macro one(dsn); proc print data=&dsn; run; %mend one; %macro two(dslist); %local i; %do i=1 %to %sysfunc(countw(&dslist)); %one(%scan(&dslist,&i)); %end; %mend two; %two(sashelp.

How do you call a macro in data step?

The macro DATASETS is used for the executing a DATA step which creates a dataset per student name. The macro parameter NAME is the student's name which is passed to the macro. To execute the macro for each name a Call Execute is used inside the DATA _NULL_ step. The data step first reads observations from the SASHELP.

What is a macro call in SAS?

Macros are compiled programs that you can call in a submitted SAS program or from a SAS command prompt. Like macro variables, you generally use macros to generate text. However, macros provide additional capabilities: Macros can contain programming statements that enable you to control how and when text is generated.

What is Call execute in SAS?

CALL EXECUTE is a very useful DATA step function which helps you stack up many SAS statements and run them together. It interacts with SAS Macro facility for immediate macro execution during the execution of DATA step.


1 Answers

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.
like image 60
D. Josefsson Avatar answered Nov 16 '22 04:11

D. Josefsson