Remerging Summary Values

Slides:



Advertisements
Similar presentations
DATABASE PROGRAMMING Sections 5-7. Write a query that shows the average, maximum, and minimum salaries for all employees with jobs in the programming.
Advertisements

11 Chapter 3: Displaying Query Results 3.1 Presenting Data 3.2 Summarizing Data.
Introduction to SQL Session 1 Retrieving Data From a Single Table.
Chapter 9 Producing Descriptive Statistics PROC MEANS; Summarize descriptive statistics for continuous numeric variables. PROC FREQ; Summarize frequency.
11 Chapter 2: Basic Queries 2.1: Overview of the SQL Procedure 2.2: Specifying Columns 2.3: Specifying Rows.
Chapter 8: Additional PROC SQL Features
Type your question here. Type Answer Type your question here. Type Answer.
Tips & Tricks From your fellow SAS users 9/30/2004.
Coinage Analysis Once you have exported the “ABA” or bank file from your payroll program, open the Coinage Analysis. Click to locate file.
11 Chapter 4: Subqueries 4.1: Noncorrelated Subqueries 4.2: Correlated Subqueries (Self-Study)
1 Checking Data with the PRINT and FREQ Procedures.
Using Subqueries to Solve Queries
Session 1 Retrieving Data From a Single Table
Chapter 6: Set Operators
Displaying Query Results
Creating Stored Procedures and Functions
Chapter 4: Using Lookup Tables to Match Data: Arrays
Click here for the answer. Click here for the answer.
Click here for the answer. Click here for the answer.
Basic Queries Specifying Columns
PROC SQL, Overview.
Chapter 5: Using DATA Step Arrays
Using Subqueries to Solve Queries
Click here for the answer. Click here for the answer.
An Introduction to SQL.
Creating Macro Variables in SQL (Review)
Noncorrelated subquery
Displaying Queries 2 Display a query’s results in a specified order.
Subsetting Rows with the WHERE clause
Outer Joins Inner joins returned only matching rows. When you join tables, you might want to include nonmatching rows as well as matching rows.
Demonstrating the Linear Model
Grouping Summary Results
Inner Joins.
Program Testing and Performance
Using Subqueries to Solve Queries
SQL Subquery.
Summarizing Data with Summary Functions
Type=Corr SAS.
5 The EXCEPT Operator Unique rows from the first result set that are not found in the second result set are selected.

The INTERSECT Operator
3 Specifying Rows.
Framingham, Exam 5 subset
3 Views.
A new keyword -- calculated
Using Subqueries to Solve Queries
Subqueries.
Hosted by Type your name here
SQL set operators and modifiers.
Hosted by Type your name here
Using Subqueries to Solve Queries
Hosted by Type your name here
UNION Operator keywords Displays all rows from both the tables
Hosted by Type your name here
Hosted by Type your name here
Hosted by Type your name here
2 Types of Subqueries.
Subqueries Schedule: Timing Topic 25 minutes Lecture
SQL – Select query Waq to display the employees with no commission.
Hosted by Type your name here
Hosted by Type your name here
Hosted by Type your name here
Jeopardy Hosted by.
Hosted by Type your name here
Hosted by Type your name here
Hosted by Type your name here
Hosted by Type your name here
Hosted by Type your name here
(Type Answer Here) (Type Answer Here) (Type Answer Here)
Hosted by Type your name here
Presentation transcript:

Remerging Summary Values

Prepare a list of employees that displays the rows employee_id, employee_gender, and salary. Include the average salary of all employees in every row.

Without SQL – Requires three steps proc means data=orion.employee_payroll noprint; where employee_term_date=.; var salary; output out=avgsal mean=avgsalary; run; data report; retain avgsalary; if _n_=1 then set avgsal; set orion.employee_payroll ; proc print data=report; var employee_id employee_gender avgsalary;

Remerging in SQL proc sql; select Employee_id "Employee ID",Employee_Gender as Gender, salary format=dollar12.2, avg(Salary) format=dollar12.2 as Average from orion.Employee_Payroll where Employee_Term_Date is missing ; quit; Type answer here

Noremerge option (a system option nosqlremerge also exists) proc sql noremerge; select Employee_Gender, avg(Salary) as Average from orion.Employee_Payroll where Employee_Term_Date is missing ; quit;