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
SAS Super FREQ
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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 800 views
  • 0 likes
  • 4 in conversation