BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sathya66
Barite | Level 11

Hi All,

 

Is there a way to feed a macro variable into every job in a flow from management console/flow manager? Without having to change every individual job or is there a way to define an environment variable set in management console as a macro variable in SAS? It isn't recognising the macro variables set at the moment

 

Thanks

SS

1 ACCEPTED SOLUTION

Accepted Solutions
SASKiwi
PROC Star

If you are using the LSF scheduler in SMC then you can add an environment variable to the job then use the SYSGET SAS function to read that into a macro variable. We use this technique ourselves and it is a great way to supply job inputs automatically.

%let batch_var = %sysfunc(sysget(batch_var)); * Reads an environment variable called batch_var.;

View solution in original post

4 REPLIES 4
gwootton
SAS Super FREQ
Could you add a %let statement to the autoexec_usermods.sas in SASApp/BatchServer? Then the macro variable would be set for every SAS session started there, which should be every job.
--
Greg Wootton | Principal Systems Technical Support Engineer
sathya66
Barite | Level 11
yes but this one only for perticuler user so we don't want to put it in autoexc.
Kurt_Bremser
Super User

When the SAS session starts, it's already running with the correct user-id, so you can query that in the autoexec.sas by using 

%if %sysget(USER) = ....
%then %do;
  %let macrovar = ....;
%end;
SASKiwi
PROC Star

If you are using the LSF scheduler in SMC then you can add an environment variable to the job then use the SYSGET SAS function to read that into a macro variable. We use this technique ourselves and it is a great way to supply job inputs automatically.

%let batch_var = %sysfunc(sysget(batch_var)); * Reads an environment variable called batch_var.;

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

Get Started with SAS Information Catalog in SAS Viya

SAS technical trainer Erin Winters shows you how to explore assets, create new data discovery agents, schedule data discovery agents, and much more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 828 views
  • 5 likes
  • 4 in conversation