Edit

SAS: PROC SQL (Where & Two New Tables)

2016/12/18
  The 'PROC SQL' can create two tables in a procedure in which two independent clauses are included.  The following example shows two tables being consisted 'Female' table and 'Male' table.  These includes all variables of 'DEMOG' (LINK). 


PROGRAM 
--------------------------------------
*************************************
WHERE CLAUSE: SUB-SETTING:
*************************************;
PROC SQL ;
  CREATE TABLE D_FEMALE  
  SELECT *
  FROM DEMOG
  WHERE SEX IN ('FEMALE') ; /*NEED SEMI-COLON HERE!*/

  CREATE TABLE D_MALE  
  SELECT *
  FROM DEMOG
  WHERE SEX IN ('MALE  ') ;
QUIT ;

PROC PRINT DATA=D_FEMALERUN;
PROC PRINT DATA=D_MALE  ;  RUN;

--------------------------------------  

OUTPUT




Search This Blog