Your SAS programs, embedded in web apps and elsewhere

How do I pass a defined macro from a EG job to EG defined stored process without using prompts func

Accepted Solution Solved
Reply
Regular Contributor
Posts: 152
Accepted Solution

How do I pass a defined macro from a EG job to EG defined stored process without using prompts func

How do I pass a defined macro from a EG job to EG defined stored process without using the prompts function in stored process.

for example in EG, I have two jobs, Job A is a normal EG job , Job is a stored process

in job A i have

%LET LOCATION=C:\TE;

 

In Job B(stored process) I have

 

LIBNAME A "&LOCATION";

 

DATA A.A;

A=1;

RUN;

 

how do I make job B recognize macro variable &location

 


Accepted Solutions
Solution
‎03-31-2016 06:31 PM
Super User
Posts: 6,936

Re: How do I pass a defined macro from a EG job to EG defined stored process without using prompts f

The Workspace Server and Stored Process Server are distinct processes that do not communicate with each other. Common environments are delivered through metadata or configuration at startup, but will stay static within each process unless deliberately changed.

Defining a macro variable as %global in the autoexec only means that the variable will be global for each process, but never across processes. And you still need to assign it a value in each process, either through setting in the autoexec or within each program or EG session.

 

If you want to share definitions dynamically across your whole SAS environment, you need to set up mechanisms to do that. You could store such information in centrally located datasets, or you could write those to SAS program files that are %included when needed.

Keep in mind that each process then must read such information repeatedly to stay current!

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

View solution in original post


All Replies
Super User
Posts: 6,936

Re: How do I pass a defined macro from a EG job to EG defined stored process without using prompts f

Put global definitions for both Workspace Server and Stored Process Server into

appserver_autoexec_usermods.sas

in your SASApp directory in your configuration tree.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Regular Contributor
Posts: 152

Re: How do I pass a defined macro from a EG job to EG defined stored process without using prompts f

[ Edited ]

Hi KurtBremser, I have defined %global location; in the appserver_autoexec_usermods, I don't get get  error message anymore  but it is still unable to pass the value from JOB A to JOB B.

Solution
‎03-31-2016 06:31 PM
Super User
Posts: 6,936

Re: How do I pass a defined macro from a EG job to EG defined stored process without using prompts f

The Workspace Server and Stored Process Server are distinct processes that do not communicate with each other. Common environments are delivered through metadata or configuration at startup, but will stay static within each process unless deliberately changed.

Defining a macro variable as %global in the autoexec only means that the variable will be global for each process, but never across processes. And you still need to assign it a value in each process, either through setting in the autoexec or within each program or EG session.

 

If you want to share definitions dynamically across your whole SAS environment, you need to set up mechanisms to do that. You could store such information in centrally located datasets, or you could write those to SAS program files that are %included when needed.

Keep in mind that each process then must read such information repeatedly to stay current!

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
☑ This topic is SOLVED.

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

Discussion stats
  • 3 replies
  • 292 views
  • 0 likes
  • 2 in conversation