Most SAS procedures produce output in a standard format. Two procedures, REPORT and TABULATE, allow some customization of output layout. DATA steps and ODS features provide the most flexibility in customizing and selecting report output. The examples in this book focus on the application of report-writing procedures, DATA steps, and ODS in producing reports.
When writing a program to create a report, you need to know which SAS procedures specialize in the kind of report you want to produce. Reports can be categorized as detail, summary, customized, and multipanel. Examples of each are shown in Figures 1.1 through 1.4.
Study Heights and Weights
Group A Males
Mean Weight: 169 Mean Height: 69.5
Group B Males
Mean Weight: 169 Mean Height: 69.5
TTest Results: Males Group A vs Group B Weight: No significant difference (p>0.05)
TTest Results: Males Group A vs Group B Height: No significant difference (p>0.05)
Group A Females
Mean Weight: 144 Mean Height: 64.6
Group B Females
Mean Weight: 139 Mean Height: 65.9
TTest Results: Females Group A vs Group B Weight: No significant difference (p>0.05)
TTest Results: Females Group A vs Group B Height: Significant difference (p < 0.05)
|
□ | Detail reports list information at the observation level of a data set (see Figure 1.1). |
□ | Summary reports summarize observations and produce output such as frequency counts and descriptive statistics (see Figure 1.2). |
□ | Customized reports list information in a style that is different than the standard output from a SAS procedure. Often these are produced with DATA step programming (see Figure 1.3). |
□ | Multipanel reports present multiple rows of information side-by-side (see Figure 1.4). |
Some overlap does exist between the categories. For example, a detail report may include summaries, and a multipanel report may contain detail and summary information.
Table 1.2 presents an overview of each category of report and the SAS procedures best suited to produce reports of that type.
Report Type | Procedure/Step | Description |
---|---|---|
Detail | Produces data listings quickly; can supply titles, footnotes, and column sums. | |
REPORT | Offers more control and customization than PROC PRINT; can produce both column and row sums; has DATA step computation abilities. | |
SQL | Combines Structured Query Language and SAS features such as formats; can manipulate data and create a SAS data set in the same step that creates the report; can produce column and row statistics; does not offer as much control over output as PROC PRINT and PROC REPORT. | |
MEANS, SUMMARY, UNIVARIATE | Computes descriptive statistics for numeric variables; can produce a printed report and create an output data set. | |
Summary | Produces only one summary report; can sum the BY variables. | |
REPORT | Combines features of the PRINT, MEANS, and TABULATE procedures with features of the DATA step in a single report-writing tool; can also create an output data set. | |
SQL | Computes descriptive statistics for one or more SAS data sets or DBMS tables; can produce a printed report or create a SAS data set. | |
TABULATE | Produces descriptive statistics in a tabular format; can produce multidimensional tables with descriptive statistics; can also create an output data set. | |
Customized | DATA Step | Produces highly customized reports of all types using SAS programming statements. |
Multipanel | All procedures when sending output to a nonlisting destination; REPORT when sending output to either the LISTING or a nonlisting destination | Produces side-by-side reports. |
Most examples in this book use PROC REPORT and PROC TABULATE. A few examples use PROC PRINT and a few examples use DATA steps. One example uses PROC MEANS and another uses PROC FREQ. PROC FORMAT is used throughout to add labels and other information to the reports.
3.128.78.30