BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
gyambqt
Obsidian | Level 7

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

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!

View solution in original post

3 REPLIES 3
gyambqt
Obsidian | Level 7

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.

Kurt_Bremser
Super User

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!

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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