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.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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