we got a bit of an unstable Oracle DB environment and I wonder if there is a way to check if table A & B is available
before I run my proc sql to select from them.
You could select from dictionaries.tables as pass through, this would return what tables are available, something like:
proc sql; connect to oracle (path=...); create table O_DATA as select * from connection to oracle ( select * from DICTIONARY.TABLES where NAME="<yourtable>"); disconnect from oracle; quit; data _null_; set o_data; call execute('proc sql; ... quit;'); run;
So pull the metadata from oracle where the name is your table (note you will need to update specifics), then in a datastep generate the proc sql to extract data only if a row for your dataset is returned, i.e. the above will return no obs if your table doesn't exist, hence will not generate the call execute.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.