Edit

SAS: PROC SQL (Outer Union Corresponding)

This is an article for other example of 'UNION clauses' example.  This clause keeps all variables as different ones regardless of the order of each variable.  Therefore, the 'OUTER UNION CORRESPONDING' is equivalent with 'SET statement' of SAS dataset.  


PROGRAM 
--------------------------------------
/* This dataset was read (LINK)*/ 
DATA DEMOG  ;SET DEMOG ;              ; RUN ;

/*-- Two datasets are prepared.--*/
DATA DEMOG1 ;SET DEMOG ; WHERE DOSE=1 ; RUN ;
DATA DEMOG2 ;SET DEMOG ; WHERE DOSE=2 ; RUN ;


/*--------------------------------------------------
* OUTER UNION CORRESPONDING                         *
* THIS IS SAME AS SET STATEMENT                     *
*---------------------------------------------------*/
PROC SQL ;
 CREATE TABLE DEMOG3 AS
  SELECT * FROM DEMOG1
    OUTER UNION CORRESPONDING
  SELECT * FROM DEMOG2
 ;
QUIT ;

DATA DEMOG4 ;
 SET DEMOG1 DEMOG2 ;
RUN ;

PROC COMPARE DATA=DEMOG3 COMP=DEMOG4 ALLOBS ;
RUN ;
--------------------------------------  



OUTPUT (DEMOG1 and DEMOG2 are equivalent.)


 

Search This Blog