Procedure features: |
CREATE VIEW statement |
GROUP BY clause |
SELECT clause
|
HAVING clause |
|
Other features: |
AVG summary function |
data set option
|
|
Tables: |
PROCLIB.PAYROLL, PROCLIB.JOBS
|
This example creates the PROC SQL view PROCLIB.JOBS from the
result of a query-expression.
PROCLIB.PAYROLL (Partial Listing)
|
|
|
libname proclib 'SAS-data-library';
options nodate pageno=1 linesize=80 pagesize=60;
| proc sql;
create view proclib.jobs(pw=red) as
|
| select Jobcode,
count(jobcode) as number label='Number', |
| avg(int((today()-birth)/365.25)) as avgage
format=2. label='Average Age',
avg(salary) as avgsal
format=dollar8. label='Average Salary' |
| from payroll
|
| group by jobcode
having avgage ge 30;
|
| title 'Current Summary Information for Each Job Category';
title2 'Average Age Greater Than Or Equal to 30';
select * from proclib.jobs(pw=red); |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.