DATA Step, Macro, Functions and more

DI Studio: Access a macro variable created in pre-processing of a job

Reply
Contributor
Posts: 51

DI Studio: Access a macro variable created in pre-processing of a job

Hi all,

I have created a macro variable in the pre-processing of a job.

[...]
%let jobname = %substr(&etls_jobname,1,5);
[...]

Now I would like to access it in the post-processing via a PROC SQL but it cant be resolved there.

[...]
WHERE jobname LIKE "&jobname"
[...]

I can't use &etls_jobname here, because it gets overwritten while some other jobs run via %include.

Any idea how I can resolve this?

Thanks a lot in advance and best regards,
Thomas
SAS Super FREQ
Posts: 8,743

Re: DI Studio: Access a macro variable created in pre-processing of a job

Hi:
This may come down to whether your macro variable is GLOBAL or LOCAL in scope, which is where the [...] becomes significant. It also depends on how and where you're running your code, whether the macro variables created on one session or server are even still available after a process closes. Depending on your configuration, a process or job that launches in a single-user session may clean up after itself, so that no macro variables are left in the Global Symbol Table on that server when the job finishes.

I suggest you contact SAS Tech support for more help.

cynthia
Respected Advisor
Posts: 3,892

Re: DI Studio: Access a macro variable created in pre-processing of a job

Like Cynthia suggests:
[...]
%global jobname;
%let jobname = %substr(&etls_jobname,1,5);
[...]

...and if you didn't do something 'exotic' in your job you'll have the macro var available in the post-processing part of this job.

HTH
Patrick
SAS Employee
Posts: 160

Re: DI Studio: Access a macro variable created in pre-processing of a job

Is your pre-processing running on the same SAS server as your SQL ?

If 'yes' then your will find rsubmit in the genereated code/log.

You can 'lift' a SAS macro like using sysrput by defining parameters in DI studio.
Ask a Question
Discussion stats
  • 3 replies
  • 154 views
  • 0 likes
  • 4 in conversation