Download presentation
Presentation is loading. Please wait.
Published byMargaret Snow Modified over 9 years ago
1
PROC REPORT organizes the output in many ways, from the simple to highly complex… PROC REPORT NOWINDOWS HEADLINE HEADSKIP; COLUMN variable-list; DEFINE variable / options ‘column heading’; By default, REPORT prints all variables in the columns and all observations in the rows if the COLUMN and DEFINE statements are omitted. If the NOWINDOWS statement is omitted then an interactive REPORT window appears… HEADLINE draws a line under the column names and HEADSKIP skips a line after the headline…
2
Let’s look at the example program on page 133… Here’s the data… Dinosaur NM West 2 6 Ellis Island NM East 1 0 Everglades NP East 5 2 Grand Canyon NP West 5 3 Great Smoky Mountains NP East 3 10 Hawaii Volcanoes NP West 2 2 Lava Beds NM West 1 1 Statue of Liberty NM East 1 0 Theodore Roosevelt NP. 2 2 Yellowstone NP West 9 11 Yosemite NP West 2 13
3
options ls=80; dm output ‘clear’; dm log ‘clear’; DATA natparks; INFILE ‘ ‘; INPUT Name $ 1-21 Type $ Region $ Museums Camping; PROC REPORT DATA = natparks NOWINDOWS HEADLINE; TITLE 'Report with Character and Numeric Variables'; RUN; PROC REPORT DATA = natparks NOWINDOWS HEADLINE; COLUMN Museums Camping; TITLE 'Report with Only Numeric Variables'; RUN; * PROC REPORT with ORDER variable, MISSING option, and column header; PROC REPORT DATA = natparks NOWINDOWS HEADLINE MISSING; COLUMN Region Name Museums Camping; DEFINE Region / ORDER; DEFINE Camping / ANALYSIS 'Camp/Grounds'; TITLE 'National Parks and Monuments Arranged by Region'; RUN;
4
The DEFINE statement specifies options for specific variables DEFINE variable / options ‘column heading’; Among the options available are: –ACROSS creates columns for each value of the variable –ANALYSIS calculates various statistics for the variable - default statistic is SUM –DISPLAY creates one row for each observation - this is the default –GROUP creates one row for each value of the variable –ORDER creates one row for each value of the variable with the rows sorted by the variable’s values You may also change the header of the column for the variable by putting the text you want in quotes after the options…a / inside the quotes means to start a new line in the header. See previous slide…
5
Summary reports are fairly simple with PROC REPORT –the GROUP option of DEFINE summarizes in the rows while the ACROSS option of DEFINE summarizes in the columns PROC REPORT DATA = natparks NOWINDOWS HEADLINE; COLUMN Region type Museums Camping; DEFINE Region / GROUP; DEFINE type / GROUP; title ‘Summary Report with two Group Variables’; RUN; PROC REPORT DATA = natparks NOWINDOWS HEADLINE; COLUMN Region type, (Museums Camping); DEFINE Region / GROUP; DEFINE type / ACROSS; title ‘Summary Report with both a GROUP and ACROSS’; RUN; *note the comma tells SAS to sum the analysis variables Museums and Camping;
6
If you want other statistics besides SUM, put the name of the statistic after a comma following the name of the variable in the COLUMN statement. PROC REPORT DATA = natparks NOWINDOWS HEADLINE; COLUMN Region type N (Museums Camping),MEAN; DEFINE Region / GROUP; DEFINE type / GROUP; title ‘Summary Report with two Group Variables & MEAN’; RUN; PROC REPORT DATA = natparks NOWINDOWS HEADLINE; COLUMN Region N type, (Museums Camping),MEAN; DEFINE Region / GROUP; DEFINE type / ACROSS; title ‘Summary Report with both a GROUP, ACROSS & MEAN’; RUN; *note the comma tells SAS to take MEANs of the analysis variables Museums and Camping;
7
You may also use the BREAK and RBREAK statements to place “breaks” between values of variables, draw lines, and then summarize over those values… PROC REPORT DATA = natparks NOWINDOWS HEADLINE; COLUMN Name Region Museums Camping; DEFINE Region / ORDER; BREAK AFTER Region/ SUMMARIZE OL SKIP; RBREAK AFTER / SUMMARIZE OL SKIP; TITLE “National Parks Summarized”; HW: Finish reading Chapter 4. Play around with TABULATE and REPORT… I will give out a take-home part of the midterm next time… Midterm exam will be on Wednesday March 21, 2007.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.