Hello, I'm used to being able to use macro variables in table names in DI Studio, mostly as parameters in loops. However when I use a CAS table the macro expression is not recognized although it's correctly registered in the "parameters" tab of the objects.
For example, if I have a loop that uses a variable &i for iterations I want it to populate one CAS table per iteration (table_1, table_2 and so on). I generate the input tables (on a mysql database) with the same method and there it works flawlessly. However each iteration of the CAS load job will fill the same CAS table called "table_&i". Is there a method to avoid this problem?
Looks like DI Studio does something that prevents resolving the macro variable. Take a look at the code that is created, and post it here.
For clarification, can you state your DI Studio and Viya versions?
Also, what connection method/transformations do you use for the interaction with CAS?
Here's my system:
DI Studio 4.904 on Windows Server 2016 10.0
SAS 9.4M7 on Red Hat Linux
Viya V.03.05M0P111119
I had a look at the code and it seems that the problem is caused by the fact that the CAS loader resolves the physical table name from the DI job dialog into a string in single quotes. As far as i know this prevents macro variables in the string from being resolved.
proc casutil incaslib="My Library" outcaslib="My Library" sessref=CAS_f7eb6675v831487fa018e835e1a03d4c;
save casdata='TABLENAME_&i';
quit;
You are absolutely right, the single quotes cause your problem.
Bring this to the attention of SAS Technical Support, to me this is a bug. DI Studio should supply that string in double quotes.
You might have to do this action in a user written transformation as a (hopefully temporary) workaround.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.
Ready to level-up your skills? Choose your own adventure.