BookmarkSubscribeRSS Feed
paul_e
Obsidian | Level 7

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?

4 REPLIES 4
LinusH
Tourmaline | Level 20

For clarification, can you state your DI Studio and Viya versions?

Also, what connection method/transformations do you use for the interaction with CAS?

Data never sleeps
paul_e
Obsidian | Level 7

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;
         
Kurt_Bremser
Super User

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.

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
  • 4 replies
  • 1528 views
  • 2 likes
  • 3 in conversation