BookmarkSubscribeRSS Feed
TomekQ
Calcite | Level 5

Hi!

 

I need to perform a transformation on all tables in a library in SAS DIS. How can I do it? Let's say that I want to delete rows based on a certain condition in every table.

 

Regards

2 REPLIES 2
LinusH
Tourmaline | Level 20

Since DI Studio is quite focused on metadata dependencies, traceability and lineage.

Therefore, it's not so easy/good to build generic jobs or keep generic metadata object (tables).

As a SAS programmer you would probably just build a macro to do this task.

 

Do the tables have the same structure?

For example if each table represent lets say one month of data, you can have part of the physical table name as macro variable. Then you can build a parameterized job which will have as input (using the loop transformation) a table with a list of tables/dates/etc). One caveat is that you can't open those tables within DI Studio to view the data, because the macro variable is not set in that work space server session that opens the table. There are work-arounds, but none perfect. 

Data never sleeps
Patrick
Opal | Level 21

@TomekQ 

Totally agree with @LinusH : That feels more like some adhoc job you need to support development and not something you'd implement as a regular DIS job in production. If so then just write some SAS code - and If you want to run it out of DIS then copy/paste this code into a DIS user written transformation - and if you want to take it one step further then connect the tables you want to delete rows from as input to the user written transformation and use the generated macros to loop over the connected tables and delete the rows from the tables of your choosing.

....and be aware that any SQL Delete only logically deletes rows so the file size of the physical SAS file won't change.

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 connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 452 views
  • 0 likes
  • 3 in conversation