Thursday, June 5, 2008

SAS Tips 1001 - Tip 13 - Knowing output dataset names in various PROCS in SAS STAT

Knowing output dataset names in various PROCS in SAS STAT: This is very important if you want to combine outputs from different SAS PROCS to bring out your own output format and to automate across many samples. This is a key step in developing data mining MACROs

1. Use the command outside of proc statements;

(before the specific proc statement) ODS TRACE ON;
(after that proc statement ) ODS TRACE OFF:

2. Run the program and look at the log and find dataset name of output files from any Procs; Check the sas output datasets to clearly understand name of the file and the contents;

3. Now take out those ODS Trace statments; introduce the following before the PROC statment:

4. ODS output Name (file name from ODS trace)=New name (it could have a specific path); /* storing it in a particular path and will not be lost after the SAS run)

5. ODS output close;

6. Now do the proc contents to know the column names and attributes.

7. In the next run use the sas dataset name as a dataset to access, to pull out your elements selectively, and to format the outputs to your needs;

A great introduction with lot of actual sample on this step and also lot more on formating and using styles and templates for output is given in
http://www.ats.ucla.edu/stat/sas/seminars/sas_ods/ODS%20Technology%20for%20Decision%20Makers.pps

This is extremely useful for automation and for large scale data mining problems.

No comments: