Hi,
[Base SAS 9.4]
I'm using a macro to create and sign-on to some asynchronous tasks with dynamic names. Here's snippet from the macro to illustrate:
%DO i = 1 %TO &num_tasks;
%GLOBAL task&i;
%LET task&i = &some_value;
SIGNON task&i;
%END;
I'd like to create one or more additional macros that do some additional processing on any tasks that have been created, but I'm unsure how to obtain a list of the task names. I'm using &num_tasks as a parameter in the macro above, but I'd prefer to obtain a list of the task names because I'm considering adding an environment/server parameter to the macro above and adding a letter before task&i, such as pTask&i, to indicate where the task should be running (and not overwrite existing tasks if the macro was run to create tasks for another environment).
I know I can use LISTTASK _ALL_ to put the list of tasks, with statuses, to my log file, but I'd like to assign the list to some kind of collection, like a dataset or an array, that I can use in my code. Are the list of tasks stored in a SASHELP table/view (i looked all through SASHELP with no luck) or some other way to obtain the tasks?
Thanks.
Set up a temp data set with the desired data elements at the beginning of your proces...then just query it prior to running your macro. You can easily pull &num_tasks with a sql query :into a macro variable...and presumably any other data elements for further processing.
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.
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.