And grand totals the sas system jobcodefltat

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: run; proc print data=work.empdata; by JobCode; sum Salary; run; Obs 1 2 3 4 ------JobCode LastName FirstName Salary 0040 0071 0091 0106 WILLIAMS PERRY SCOTT THACKER ARLENE M. ROBERT A. HARVEY F. DAVID S. 23666.12 21957.71 32278.40 24161.14 --------102063.37 ------------------------ JobCode=PILOT ------------------------Obs 5 6 7 8 ------JobCode Using a BY statement and a SUM statement together in a PROC PRINT step produces subtotals and grand totals. Emp ID Emp ID LastName FirstName Salary 0031 0082 0355 0366 GOLDENBERG MCGWIERMCGWIER-WATTS BELL GLENN DESIREE CHRISTINA THOMAS B. MARTHA S. 50221.62 96387.39 59803.16 120202.38 --------326614.55 ========= 428677.92 29 30 Printing the Number of Observations Printing the Number of Observations The SAS System Print the data set grouped by JobCode with the number of observations for each JobCode. ------------------------ JobCode=FLTAT ------------------------------Obs proc sort data=st.empdata out=work.empdata; by JobCode; run; proc print data=work.empdata n=‘Number of Employees = ’; by JobCode; run; 1 2 3 4 Emp ID LastName FirstName Salary 0040 0071 0091 0106 WILLIAMS PERRY SCOTT THACKER ARLENE M. ROBERT A. HARVEY F. DAVID S. 23666.12 21957.71 32278.40 24161.14 Number of Employees = 4 ----------------------------------------- JobCode=PILOT ------------------- Obs LastName FirstName Salary 5 6 7 8 Using a BY statement and the N= option (in the PROC PRINT statement) together in a PROC PRINT step prints the number of observation for each group . Emp ID 0031 0082 0355 0366 GOLDENBERG MCGWIER-WATTS BELL GLENN DESIREE CHRISTINA THOMAS B. MARTHA S. 50221.62 96387.39 59803.16 120202.38 Number of Employees = 4 31 32 8 Page Breaks Page Breaks First Page Use the PAGEBY statement to put each subgroup on a separate page. The SAS System 1 ------------------------ JobCode=FLTAT ------------------------- General form of the PAGEBY statement: Obs PAGEBY by-variable; 1 2 3 4 ------JobCode proc print data=work.empdata; by JobCode; pageby JobCode; sum Salary; run; Emp ID LastName FirstName Salary 0040 0071 0091 0106 WILLIAMS PERRY SCOTT THACKER ARLENE M. ROBERT A. HARVEY F. DAVID S. 23666.12 21957.71 32278.40 24161.14 --------102063.37 The PAGEBY statement must be used with a BY statement. 33 Page Breaks Identifying Observations Second Page The SAS System • The ID statement enables you to 2 – suppress the Obs column in the report – specify which variable(s) should replace the Obs column. ------------------------ JobCode=PILOT ------------------------- Obs 5 6 7 8 ------JobCode Emp ID LastName FirstName Salary 0031 0082 0355 0366 GOLDENBERG MCGWIERMCGWIER-WATTS BELL GLENN DESIREE CHRISTINA THOMAS B. MARTHA S. 34 50221.62 96387.39 59803.16 120202.38 --------326614.55 ========= 428677.92 • General form of the ID statement: ID variable(s); 35 36 9 Creating a Default List Report Special BY-Group Formatting st.empdata EmpID LastName 0031 GOLDENBERG DESIREE FirstName JobCode 0040 0071 Salary PILOT 50221.62 WILLIAMS ARLENE M. FLTAT...
View Full Document

Ask a homework question - tutors are online