Comparing Outer Unions and Other SAS Techniques

A PROC SQL set operation that uses the OUTER UNION operator is just one SAS technique that you can use to concatenate tables, as shown in the following programs. Program 1 is the PROC SQL set operation that was shown earlier in this chapter. Program 2 uses a different SAS technique to concatenate the hypothetical tables One and Two.

Program 1: PROC SQL OUTER UNION Set Operation with CORR

proc sql;
   create table three as 
      select * from one 
      outer union corr
      select * from two;
quit;

Program 2: DATA Step, SET Statement, and PROC PRINT Step

 data three; 
    set one two; 
 run;
 proc print data=three noobs; 
 run; 
These two programs create the same table as output, as shown below.
DATA Step, SET Statement, and PROC PRINT Step
When tables have a same-named column, the PROC SQL outer union does not produce the same output unless the keyword CORR is also used. CORR causes the same-named columns (in this example, the two columns named X) to be overlaid; without CORR, the OUTER UNION operator includes both of the same-named columns in the result set. The DATA step program generates only one column X.
The two concatenation techniques shown above also vary in efficiency. A PROC SQL set operation generally requires more computer resources but might be more convenient and flexible than the DATA step equivalent.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.227.134.154