BookmarkSubscribeRSS Feed
EinarRoed
Pyrite | Level 9

Is there a way for two DI Studio jobs to share the same parameter? I know I can import a parameter from one job to another, but I need them to be "the same". If I change the parameter in one job, it should also automatically be changed for the other one. The parameter I have in mind would be a very simple numeric one, with a value from 1-10.

4 REPLIES 4
LinusH
Tourmaline | Level 20

What do you mean by changing the parameter?

The name, or the (default) value of it?

Parameters are meant to be dynamic, and the value of the parameter is set during run time. How do you set your parameter value?

Data never sleeps
EinarRoed
Pyrite | Level 9

LinusH: I have one job where I've set up a parameter called &delay with the value "2". I then import the parameter into a second job, so that both jobs have identical &delay parameters. The problem is that if I change it from "2" to "3" in one job, it doesn't change in the other. I need to find a way for it to do so.

FredrikE: Thanks, I'll go through the suggestions. Smiley Happy

LinusH
Tourmaline | Level 20

As i mentioned, parameters are mainly set in run time.

Setting default values is primarily for testing in DI. If you don't pass parameters into the job, you could as well set a macro variable in the pre-code.

Is it a parameter you really need? By following Frediks suggestions, you don't need parameters, just use macro variables right off.

parameters are used when calling a job from an outer job, linking variable values to parameters, or if your job is deployed as a Stored Process.

Data never sleeps
FredrikE
Rhodochrosite | Level 12

I guess some of these might help you:

- Set the parameter in the autoexec, either directly with %let or by reading a table and assigning the vairable. Then use it in the two jobs.

- Store the parameter in a table and create a macro that read the table and create the parameter. Put the macro in then pre-code of the two jobs.

- Create a macro that define the parameter using %let and add the macro to the pre-code of the two jobs.

I'm sure you can find more solutions, but some of these should do the job....

//Fredrik

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 connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 895 views
  • 6 likes
  • 3 in conversation