Skip to main content
v2026.11,986 entries · CC-BY 4.0

PROC REPORT in SAS: Syntax, DEFINE Usages and Output

How to use PROC REPORT in SAS: detail and summary reports, DEFINE usages, options, reading the output and fixing common display problems.

Written and maintained by CASRAI Editorial Board

Published

On this page

PROC REPORT is the SAS procedure for building tabular reports from a data set. SAS documents it as combining features of the PRINT, MEANS and TABULATE procedures with features of the DATA step in a single report-writing tool. You submit proc report data=your_data; with optional COLUMN and DEFINE statements to choose which variables appear, how each one behaves (display, group, analysis, across, order or computed) and how the result is formatted, then end the step with run;.

This guide covers PROC REPORT in SAS for researchers and analysts: what it is for, how to get access to run it, a step-by-step build of a detail and a summary report, how to read the result, common display problems, and free ways to practise. The syntax described here comes from SAS documentation for the REPORT procedure and a university-hosted copy of the SAS reference text; the data table below compares the six DEFINE usages.

What PROC REPORT is used for in research

In research work PROC REPORT is the step that turns an analysis data set into a table a reader can use: a listing of participants, a summary of a measure by group, or a table with one column per value of a variable. The SAS documentation describes two basic report shapes:

  • Detail report: “A detail report contains one row for every observation selected for the report.”
  • Summary report: “A summary report consolidates data so that each row represents multiple observations.”

Either shape can also carry summary lines, which SAS describes as summarising numerical data for a set of detail rows or for all detail rows. The documentation’s example reports include a simple detail report, an ordered detail report with default and customised summaries, a summary report, a summary report with a column for each value of a variable, a customised summary report with each manager’s store on a separate page, and HTML output with customised style elements.

PROC REPORT compared with PRINT, MEANS and TABULATE

Because PROC REPORT overlaps three older procedures, it is worth knowing when a simpler step is enough. PROC PRINT lists observations, PROC MEANS calculates descriptive statistics, and PROC TABULATE builds cross-tabulated tables; SAS positions PROC REPORT as the single tool that can do all three kinds of output and add DATA-step-style calculations in COMPUTE blocks. If you only need descriptive statistics for analysis rather than presentation, see the guide to PROC UNIVARIATE in SAS; if you need to check that two data sets match before reporting on them, see PROC COMPARE in SAS.

How to install or access SAS to run PROC REPORT

PROC REPORT is part of the SAS software you run, so access means getting a SAS session. Many universities and employers license SAS locally; check with your institution’s research computing or statistics support. For learning, SAS offers SAS OnDemand for Academics, described by SAS as a free, cloud-based learning environment. It runs SAS Studio in a browser on any operating system, and SAS Enterprise Guide is also available; SAS directs independent learners to SAS Studio. Sign-in is at welcome.oda.sas.com.

Once you are in SAS Studio, open a new program, paste the PROC REPORT step, and run it. Reports go to the results tab; the destination (for example HTML) is set through the Output Delivery System. For a first program that creates and inspects data before reporting, see Coding in SAS: DATA step, PROC step and first program.

Three ways SAS documents for running PROC REPORT

  1. In a nonwindowing environment, by submitting statements with the NOWINDOWS option (abbreviated NOWD in the examples) on the PROC REPORT statement.
  2. In the interactive REPORT window with a prompting facility that guides you as you build the report.
  3. In the interactive REPORT window without the prompting facility.

Programs written for batch or notebook-style submission use the first mode, and that is the form shown below.

How to build a report with PROC REPORT step by step

Step 1: Start with a simple detail report

The SAS documentation’s first example is a detail report with one row for every observation that passes a WHERE statement, with formats applied for display:

proc report data=grocery nowd;
   where sector='se';
   format sector $sctrfmt. manager $mgrfmt. dept $deptfmt. sales dollar10.2;
run;

The documentation notes that without a DEFINE statement, PROC REPORT uses default characteristics for each variable, so this short step already produces a complete report.

Step 2: Choose and order columns with COLUMN

The COLUMN statement sets the arrangement of columns and spanning headers. A report-item can be given an alias with report-item=name. SAS notes that you cannot use the COLUMN statement if you use the REPORT= option to load a saved report definition.

proc report data=mydata nowd;
   column group_var outcome;
run;

Step 3: Set how each variable behaves with DEFINE

The DEFINE statement has the form DEFINE report-item / usage attributes options justification column-header style;. The usage decides what the variable does in the report. The data table below lists all six usages. Two rules matter in practice: the default statistic for an analysis variable is SUM, and naming a statistic in the DEFINE statement implies the ANALYSIS usage.

proc report data=mydata nowd;
   column group_var outcome;
   define group_var / group 'Group';
   define outcome / analysis mean format=8.2 'Mean outcome';
run;

Here group_var is a group variable, so each distinct value becomes one row, and outcome is an analysis variable summarised with the MEAN statistic instead of the default SUM. The quoted text is the column header.

Step 4: Add a column for each value with ACROSS

To get one column per value of a variable, define that variable with the ACROSS usage. This is how the documentation’s summary report “with a column for each value of a variable” is built, and it is the usual way to make a table with treatment arms side by side.

Step 5: Control the layout with DEFINE options

The option table below lists the DEFINE options documented in the SAS reference text, each with its documented effect. Only a few are needed for most reports: FORMAT=, WIDTH=, ORDER=, DESCENDING and NOPRINT.

DEFINE option Documented effect
FORMAT= Assigns a SAS or user-defined format to the item, for display only.
WIDTH= Sets the column width.
ORDER= Sets the sort order for group, order or across variables: DATA, FORMATTED (the default), FREQ or INTERNAL.
DESCENDING Reverses the display order of rows or of group, order or across values.
FLOW Wraps character values within their column; no effect on HTML or Printer output.
NOPRINT Hides the item but keeps its values available for calculations and ordering.
NOZERO Hides the item when all its values are zero or missing.
ID Keeps the item and all columns to its left on every page.
PAGE Inserts a page break before the first column of the item.
SPACING= Sets the blank characters before the column (default 2).
STYLE= Applies an Output Delivery System style element; affects HTML and Printer output only.

Step 6: Add summary lines

The BREAK and RBREAK statements add summary lines to the report, and the COMPUTE and ENDCOMP statements wrap DATA-step-style code that calculates values or writes custom lines. The full statement list documented for the procedure is PROC REPORT, BREAK, BY, CALL DEFINE, COLUMN, COMPUTE, DEFINE, ENDCOMP, FREQ, LINE, RBREAK and WEIGHT.

Procedure-level options worth knowing

The PROC REPORT statement itself accepts options including DATA= and OUT= (an output data set), WINDOWS or NOWINDOWS, MISSING, HEADLINE, HEADSKIP, NOHEADER, NAMED, SPLIT=, SPACING=, COLWIDTH= (default 9), LS= and PS= (line and page size), WRAP, BOX, CENTER or NOCENTER, LIST, NOEXEC, REPORT= and STYLE=. LIST writes the PROC REPORT code for the report to the log, which is useful for seeing what an interactive session built, and NOEXEC checks the statements without producing the report.

How to read the output

Read a PROC REPORT table by identifying what each column is. Display variables show the value of each observation in the row; group, order and across variables organise rows or columns; analysis variables show a statistic, SUM unless you named another one; computed variables show values calculated in a COMPUTE block. The six usages are compared in the data table below.

  • Detail rows: one row for each selected observation. If you see as many rows as observations, no group variable collapsed the data.
  • Summary rows: each row represents several observations. Check which variable is defined with the GROUP usage to know what a row stands for.
  • Summary lines: totals or statistics for a set of detail rows or for all of them, added by BREAK or RBREAK.
  • Column headers: the text in quotes on the DEFINE statement; without it the variable name or label is used. Check that a heading such as “Mean outcome” matches the statistic you actually named.

To confirm a summary against the source data, compare it with a dedicated procedure’s output or inspect the input with PROC CONTENTS in SAS to confirm variable types and formats before interpreting the report.

Troubleshooting PROC REPORT

  • BOX, CENTER or FLOW appear to do nothing. The documentation states that BOX and CENTER have no effect on HTML or Printer output, and that FLOW has no effect on HTML or Printer output either. Check the destination you are sending output to.
  • Error when using COLUMN together with REPORT=. You cannot use the COLUMN statement if you use the REPORT= option; the saved report definition supplies the columns.
  • A numeric column shows totals instead of averages. The default statistic for an analysis variable is SUM. Name the statistic in DEFINE, for example define outcome / analysis mean;.
  • Rows are in an unexpected order. The default ORDER= value is FORMATTED, so values sort by their formatted text. Use ORDER=INTERNAL for the underlying value, ORDER=DATA for input order, or DESCENDING to reverse.
  • A helper variable should not be shown. Define it with NOPRINT; its values stay available for ordering and calculations.
  • Columns are too narrow for long values. The default column width is set by COLWIDTH= (default 9); set WIDTH= in the DEFINE statement for that item, or use FLOW to wrap character values in listing output.
  • Not sure what an interactive session built. Use the LIST option to write the PROC REPORT code to the log.

If a step fails before PROC REPORT runs, check that the input data set exists and that variable names in COLUMN and DEFINE match it exactly. When your report needs data reshaped first, see PROC TRANSPOSE in SAS.

Free alternatives to PROC REPORT

There is no free, drop-in replacement for PROC REPORT’s syntax. The practical free options are ways to run the same code, or simpler SAS procedures that cover part of the job:

Option What it gives you Source
SAS OnDemand for Academics A free, cloud-based learning environment with SAS Studio in a browser on any operating system, and SAS Enterprise Guide. SAS
PROC PRINT Simple listings of observations, the detail-report subset of PROC REPORT. SAS REPORT overview
PROC MEANS Descriptive statistics by group, the summary-report subset of PROC REPORT. SAS REPORT overview
PROC TABULATE Cross-tabulated tables of statistics. SAS REPORT overview

The three procedures are part of SAS itself, so they are available wherever you can run SAS. For querying and summarising with SQL instead, see SAS SQL: PROC SQL queries, joins and checks.

Sources

Data: PROC REPORT DEFINE statement usages compared

The six usages of the PROC REPORT DEFINE statement (ACROSS, ANALYSIS, COMPUTED, DISPLAY, GROUP, ORDER) with what each does to a variable, compiled from the SAS reference text for the DEFINE statement and the REPORT procedure documentation.

PROC REPORT DEFINE statement usages compared
DEFINE usageWhat it does to the variableDocumented note
ACROSSMakes a data set variable an across variableUsed for a column for each value of a variable
ANALYSISMakes a data set variable an analysis variableDefault statistic is SUM; naming a statistic implies this usage
COMPUTEDDefines a variable not in the input data setValue is set in a compute block
DISPLAYMakes a data set variable a display variableShows the value of each selected observation
GROUPMakes a data set variable a group variableRows consolidate so each row represents multiple observations
ORDERMakes a data set variable an order variableSets row order; default ORDER= value is FORMATTED

Sources

Compiled by CASRAI from the sources above. Free to reuse under CC BY 4.0 with attribution.

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · full access

Ask about PROC REPORT in SAS: Syntax, DEFINE Usages and Output

Full access: large monthly usage, up to 10 source passages behind each answer, and MCP and API access for Claude Code, Codex and other CLIs. Cancel any time.

An AI assistant for research: funder rules, compliance, methods and publishing. It links the sources behind its answers and labels answers that come from a web search.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays open to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →