1
votes

MY SITUATION I hope all is well. I am currently undertaking a research project with deals with a lot a datasets placed under different libraries. I have created multiple %macro definitions which in turn has generated many output tables and utilised many input tables. These tables are saved under different libraries.

MY ISSUE: My computer slows down when these datafiles are created. Clearing unwanted tables in every macro program session speedens up computational response.

My QUERY: Is there a way to generate a list of input and output tables created either using PROC SQL or DATA steps by each macro program? Each MACRO PROGRAM has multiple %macros, once again from code readability purposes. Prefixing/suffixing the datafiles with 'IN' or 'OUT' statements does not help. This would help me in data management.

1
Odds are you have a lot of things you could do to improve things, but without posting any code or any other way of showing us what you're actually doing, you're not going to get much useful help. Post an example (a trivial macro or set of them that allows us to see what you're doing, without really having much code in it, and runs from a dataset you include in the code as datalines or comes from SASHELP).Joe

1 Answers

5
votes

You probably have two options: parsing a log file or making a snapshot of dictionary.tables before and after every macro call and extracting the differences. I would prefer an ( easier :)) second option, e.g. like

PROC SQL;
CREATE TABLE BEFORE AS SELECT CATS(libname,".",memname) AS fname FROM DICTIONARY.tables WHERE libname in ('WORK');
QUIT;

PROC SQL;
CREATE TABLE AFTER AS SELECT CATS(libname,".",memname) AS fname FROM DICTIONARY.tables WHERE libname in ('WORK') AND calculated fname not in (select fname FROM BEFORE); 
QUIT;