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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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