The SAS Output Delivery System and reporting techniques

Dynamic Check Dataset Exists

Posts: 0

Dynamic Check Dataset Exists

Hello All,

I have a program that needs to be manually changed every month to take into account the latest monthly file (I have to add a new libname line every month and add the correspoding libname reference to my SET statement in my DATA step). I could obviously create libname statements for the months that haven't occured yet, but then I would still have to add the libname reference in the DATA step each month or else the program would tell me dataset doesn't exist. Is there any way around this?

Posts: 8,744

Re: Dynamic Check Dataset Exists

This is not an ODS question or a BASE Reporting procedure question.

What you want to do can probably be accomplished with the use of SAS Macro programming and several possible methods, which include, but are not limited to using functions that check for data set existence or using the dataset dictionary.tables (assuming that you have issued a LIBNAME statement), or even piping the results of a DIR command to a file and then building the LIBNAME statement and DATA step program dynamically with SAS Macro.

Your best bet for help with this question is to contact Tech Support and/or to search for other papers like this one:
that show the kind of techniques you would need to use.

Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation