BookmarkSubscribeRSS Feed
ThomasH
Calcite | Level 5
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
3 REPLIES 3
Cynthia_sas
Diamond | Level 26
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
Patrick
Opal | Level 21
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
GertNissen
Barite | Level 11
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.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 3 replies
  • 1391 views
  • 0 likes
  • 4 in conversation