Announcement

Collapse
No announcement yet.

Proc Contents with Data Set Selection

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Proc Contents with Data Set Selection

    Proc Contents Report with Data Set Selection

    Following is an example of how to create a proc contents report template that provides a data set selection to the user. The report template ODS options can be used to send the output to HTML or RTF or PDF.

    First, under System Admin \ Reports \ Report Library, create a new program entry. You can do this by saving the attached ProcContents.txt Report code or by cutting and pasting the code from the following code block.

    Code:
    /**** Content Listing Report *****/
    %macro runit;                                                                 
       %if &sel1 > 0 %then %do;                
          %do i=1 %to &sel1;                                                      
             Proc contents data=pviews.&&sel1_&i varnum;                                 
             run;                                                                 
          %end;                                                                   
       %end;                                                                      
       %else %do;                                                                 
          data _null_;                                                            
             file print;                                                          
             put 'Note: No selection was made.';                                  
          run;                                                                    
       %end;                                                                      
    %mend runit;                                                                  
    %runit;                                                                       
    /*** End of Program ***/
    Next, under System Admin \ Reports \ Report Templates, add a new Global report template which points at the program added above. The report type must be Current Study Only. Add the data set selection criteria using the data view PVIEWS.DATASETS as the source data set and the variable DATASETNAME as the selection variable.

    Example Screen Shot:

    Attached Files
    Last edited by Greg Wagner; 05-19-2011, 09:37 AM.
Working...
X