Содержание
- 2. Overview Basic Structure Verifying Statements Specifying Columns Specifying Rows
- 3. Introduction SQL is a modular language that uses statements and clauses.
- 4. Basic structure of PROC SQL: PROC SQL; statement (select) clauses (from, where, group by, having, order
- 5. Statements select - specifies the columns to be selected Select statement has the following features: -selects
- 6. Clauses from - specifies the tables to be queried where - subsets the data based on
- 7. Basic Structure Verifying Statements Specifying Columns Specifying Rows Overview
- 8. Verifying Statements Two functions that can be used to verify if your statement syntax are: validate
- 9. Validate proc sql; validate select timemile, restpulse, maxpulse from project.fitness where timemile gt 7; NOTE: PROC
- 10. NoExect proc sql noexec; select timemile, restpulse, maxpulse from project.fitness where timemile gt 7; NOTE: Statement
- 11. Contrasting Features of validate: -tests syntax of query without executing the query -checks the validity of
- 12. Overview Basic Structure Verifying Statements Specifying Columns Specifying Rows
- 13. Specifying Columns Objectives -Displaying columns directly from a table -Displaying columns calculated from other columns -Calculating
- 14. Displaying data from a table To print all of a table columns in the order that
- 15. Printing Specify Columns If you do not want to print out all columns in a table
- 16. Calculating Columns We can calculate a new column by using data in an existing column and
- 17. Calculated columns using SAS Dates Recall from previous chapters in our SAS book that dates are
- 18. Example: Calculate the range of dates in a Dailyprices dataset. CODE: OUTPUT:
- 19. Creating new columns The use of CASE expression can be used to create a new column
- 20. Creating a table To create and populate a table with the rows from an SQL query,
- 21. Overview Basic Structure Verifying Statements Specifying Columns Specifying Rows
- 22. Specifying Rows in a table Objectives -Selecting a subset of rows -Removing duplicate rows -Subsetting using
- 23. Selecting a subset of rows proc sql; title 'large orders'; select Product_ID, total_retail_price from d2data.order_item where
- 24. Where clause Use a where to specify a condition that data must fulfill before being selected.
- 25. Removing duplications Use distinct keyword to eliminate duplications. CODE (without DISTINCT): CODE (with DISTINCT): OUTPUT:
- 26. Escape Clause The escape clause allows you to designate a single character that will indicate how
- 27. Subsetting calculated values Since the where clause is evaluated before the select, it's possible for an
- 28. Subsetting calculated values proc sql; title 'Lack of profit'; select Product_ID, ((total_retail_price/quantity) - costprice_per_Unit) as profit
- 30. Скачать презентацию