Edit

SAS: PROC SQL (Over All)

2016/12/186
  This is the first article for SQL procedure on SAS, and I describe a brief syntax before showing examples in next article.  As general rule, this procedure initiates 'PROC SQL' and ends 'QUIT.'  Between these two, several clauses are available to define table(s).  One note is that these are clauses to define a table and they are not statements.  In other words, semi-colon, ';'  are not needed at the end of each clause. 

As one example of select statement syntax, Kaite showed the following example.    -----------------------------------------------
PROC SQL options ;
  SELECT column(s)
  FROM table-name | view-name
   WHERE expression
   GROUP BY column(s)
   HAVING expression
   ORDER BY column(s);
QUIT;
----------------------------------------------- 


In my quick review, the following clauses seems useful to create table from my perspective from the following cited papers/blogs. 
-----------------------------------------------
PROC SQL ;
    CREATE TABLE (Table creation)
    SELECT (Extract variables)
    FROM (Source Table)
    WHERE (Extract condition)
    GROUP BY (Summary by variable)
    ORDER BY (Sort)
    HAVING (Extract after summarizing)

    INNER JOIN (Merge and keep common variables in these two tables)
    LEFT JOIN (Merge followed by extract only variables in left table)
    RIGHT JOIN (Merge followed by extract only right table)
    FULL JOIN (Merge and keep these two table's variables)

    UNION (Set statement)
    INSERT (Add record)
    DELETE (delete lecode)
    UPDATE (update data)
END;
----------------------------------------------- 



Works Cited. 
 
Katie Minten Ronk.  'Introduction to Proc SQL.'  SUGI29PDF_File

Thomas J. Winn Jr.,  'Intermediate PROC SQL.'  SUGI23. PDF_File

'SAS 備忘録' のPROC SQLに関する記事. Link

Search This Blog