SAS Lesson 5 - Analyzing & Reporting Data PDF
Document Details
Uploaded by NonViolentRutherfordium5305
2023
Tags
Summary
This document summarizes SAS Lesson 5 about analyzing and reporting on data. It covers topics like enhancing reports with titles, footnotes, and labels, and creating frequency and summary reports. Example code using PROC statements is also provided.
Full Transcript
Print Summary of Lesson 5: Analyzing and Reporting on Data Enhancing Reports with Titles, Footnotes, and Labels TITLE is a global statement that establishes a permanent title for all reports created in your SAS session. You can have up to 10 titles, in which case you would just use a n...
Print Summary of Lesson 5: Analyzing and Reporting on Data Enhancing Reports with Titles, Footnotes, and Labels TITLE is a global statement that establishes a permanent title for all reports created in your SAS session. You can have up to 10 titles, in which case you would just use a number 1-10 after the keyword TITLE to indicate the line number. TITLE and TITLE1 are equivalent. Titles can be replaced with an additional TITLE statement with the same number. TITLE; clears all titles. You can also add footnotes to any report with the FOOTNOTE statement. The same rules for titles apply for footnotes. Labels can be used to provide more descriptive column headers. A label can include any text up to 256 characters. All procedures automatically display labels with the exception of PROC PRINT. You must add the LABEL option in the PROC PRINT statement. TITLE "title-text"; FOOTNOTE "footnote-text"; LABEL col-name="label-text"; To create a grouped report, first use PROC SORT to arrange the data by the grouping variable, and then use the BY statement in the reporting procedure. PROC procedure-name; BY col-name; RUN; Creating Frequency Reports PROC FREQ creates a frequency table for each variable in the input table by default. You can limit the variables analyzed by using the TABLES statement. PROC FREQ DATA=input-table; TABLES col-name(s) < / options>; RUN; PROC FREQ statement options: ORDER=FREQ|FORMATTED|DATA NLEVELS TABLES statement options: NOCUM NOPERCENT PLOT=FREQPLOT (must turn on ODS graphics) OUT=output-table One or more TABLES statements can be used to define frequency tables and options. ODS graphics enable graph options to be used in the TABLES statement. WHERE, FORMAT, and LABEL statements can be used in PROC FREQ to customize the report. When you place an asterisk between two columns in the TABLES statement, PROC FREQ produces a two-way frequency or crosstabulation report. PROC FREQ DATA=input-table; TABLES col-name*col-name < / options>; RUN; Creating Summary Statistics Reports Options in the PROC MEANS statement control the statistics included in the report. The CLASS statement specifies variables to group the data before calculating statistics. The WAYS statement specifies the number of ways to make unique combinations of class variables. PROC MEANS DATA=input-table ; VAR col-name(s); CLASS col-name(s); WAYS n; RUN; The OUTPUT statement creates an output SAS table with summary statistics. Options in the OUTPUT statement determine the contents of the table. PROC MEANS DATA=input-table ; VAR col-name(s); CLASS col-name(s); WAYS n; OUTPUT OUT=output-table < / option(s); RUN; Copyright © 2023 SAS Institute Inc., Cary, NC, USA. All rights reserved.