a1 has all datasets info down to variable level. I know I can use another proc sql(see code below) to get the list of dataset names. But I still want to know how to do it in proc contents or any other procedures if this is possible.
But, ODS OUTPUT will create an output dataset from the output object MEMBERS. If you use ODS TRACE ON/ODS TRACE OFF around PROC DATASETS, you will see the following output:
893 ods trace on;
894 proc datasets library=work memtype=data;
Physical Name C:\DOCUME~1\Temp\SAS Temporary Files\_TD5040
Filename C:\DOCUME~1\Temp\SAS Temporary Files\_TD5040
Label: Library Members
# Name Type Size Last Modified
1 MEMBERS DATA 5120 22Nov10:15:50:19
2 PRDSALE DATA 50176 22Nov10:10:57:31
3 REPORT_DATA DATA 209920 22Nov10:08:45:15
NOTE: PROCEDURE DATASETS used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
897 ods trace off;
The "Output Added" means that the procedure created an "output object" and it is this ODS output object that gets routed to ODS destinations. Not all ODS destinations are report destinations like LISTING, RTF and PDF and HTML. ODS DOCUMENT and ODS OUTPUT are destinations that are NOT report destinations. ODS OUTPUT is the destination that creates output datasets.
That means that you can write the output object "MEMBERS" to a dataset with the ODS OUTPUT statement, as shown in data _null_'s code. One of the great features of the Output Delivery System is the fact that if a procedure creates an output object you can make a dataset from that output object -- EVEN IF the dataset itself does not support or have an OUT= option or OUTPUT statement.
Check it out. There are a lot of good papers and examples out there on the use of ODS OUTPUT.