/**********************************************************************/


data employee;                                              
   merge empname(keep=empnum lastname frstname initial      
                 in=empname)                                
         empsupt(keep=empnum ername erphone);               
   by empnum;                                               
   if empname;                                              
run;                                                        
                                                            
   /* this code is added for testing only                 */
                                                            
title 'Employee Data Set';                                  
                                                            
proc contents data=employee;                                
run;                                                        
                                                            
proc print data=employee;                                   
run;                                                        
                                                            
title;                                                      
                                                            
   /* end of test prints                                  */


/**********************************************************************/


%macro tprint(ds=,          /* input data set name        */
              title= );     /* title for test print       */
                                                            
%global test;                                               
   %if %upcase(&test) eq Y %then                            
   %do;  /* Execute test code                             */
                                                            
         /* In programs executing in a display manager    */
         /* session, use the DM statement and             */
         /* the AUTOPOP window feature to avoid           */
         /* having to press ENTER when the OUTPUT         */
         /* window is updated.                            */
                                                            
      dm output 'autopop off' pgm; /* Disable AUTOPOP     */
                                                            
      title "&title";                                       
      title3 "Contents of &ds Data Set";                    
                                                            
      proc contents data=&ds;                               
      run;
                                                            
      title3 "Print of &ds Data Set";                       
                                                            
      proc print data=&ds;                                  
      run;                                                  
                                                            
      title;                                                
                                                            
      dm output 'autopop on' pgm; /* Restore AUTOPOP      */
                                                            
   %end; /* Execute test code                             */
                                                            
%mend tprint;


/**********************************************************************/


%let test=Y;


/**********************************************************************/
 

data employee;                                        
   merge empname(keep=empnum lastname frstname initial
                 in=empname)                          
         empsupt(keep=empnum ername erphone);         
   by empnum;                                         
   if empname;                                        
run;
                                                  
%tprint(title=Merge Employee Name and Contact Files,
        ds=employee)

                                
/**********************************************************************/