This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: STAT 475 Chapter 1 PERFORMING QUERIES USING PROC SQL Reference SAS Certification Prep Guide: Advanced Programming for SAS 9 PROC SQL step provides an efficient way to retrieve information from data sets. The abbreviation SQL stands for Structured Query Language . There are several statements that can be used with the PROC SQL step. We will study the SELECT statement . A PROC SQL step that contains one or more SELECT statements is called a PROC SQL query . THE SELECT STATEMENT The syntax is as follows: PROC SQL; SELECT variable1 , variable2 , &lt; as newvariable&gt; FROM dataset1 dataset2 WHERE expression GROUP BY variable1 variable2 ; ORDER BY variablename1 variablename2 ; QUIT; SELECT specifies column(s) to be selected FROM specifies table(s) to be queried WHERE subsets the data based on the specified expression GROUP BY groups data by specified variable(s) ORDER BY classifies the data into groups based on the specified column(s) The SELECT is a statement is composed of clauses : FROM, WHERE, GROUP BY, ORDER BY. These clauses must appear in the specified order. Date sets listed under the FROM clause are referred to as tables . 1 To terminate PROC SQL, the QUIT statement must be specified. Example. Class roster contains students names, IDs, scores on the final, total scores and letter grades. The following code uses PROC SQL to select the students with passing grades and to sort the grade roster in alphabetical order.grades and to sort the grade roster in alphabetical order....
View Full Document
- Fall '11