Summary of Lesson 4: Producing Detail Reports: Topic Summaries
Summary of Lesson 4: Producing Detail Reports: Topic Summaries
Topic Summaries
To go to the movie where you learned a task or concept, select a link.
You can use the VAR statement in a PROC PRINT step to subset the variables in a report. You specify the
variables to include and list them in the order in which they are to be displayed.
You can use the SUM statement in a PROC PRINT step to calculate and display report totals for the
requested numeric variables.
The WHERE statement in a PROC PRINT step subsets the observations in a report. When you use a
WHERE statement, the output contains only the observations that meet the conditions specified in the
WHERE expression. This expression is a sequence of operands and operators that form a set of
instructions that define the condition. The operands can be constants or variables. Remember that variable
operands must be defined in the input data set. Operators include comparison, arithmetic, logical, and
special WHERE operators.
WHERE where-expression;
You can use the ID statement in a PROC PRINT step to specify a variable to print at the beginning of the
row instead of an observation number. The variable that you specify replaces the Obs column.
ID variable(s);
The SORT procedure sorts the observations in a data set. You can sort on one variable or multiple
variables, sort on character or numeric variables, and sort in ascending or descending order. By default,
SAS replaces the original SAS data set unless you use the OUT= option to specify an output data set.
PROC SORT does not generate printed output.
Every PROC SORT step must include a BY statement to specify one or more BY variables. These are
variables in the input data set whose values are used to sort the data. By default, SAS sorts in ascending
order, but you can use the keyword DESCENDING to specify that the values of a variable are to be sorted
in descending order. When your SORT step has multiple BY variables, some variables can be in ascending
and others in descending order.
You can also use a BY statement in PROC PRINT to display observations grouped by a particular variable
or variables. The groups are referred to as BY groups. Remember that the input data set must be sorted on
the variables specified in the BY statement.
https://vle.sas.com/pluginfile.php/30235/mod_scorm/content/17/m415/m415_4_a_sum.htm 1/4
14/05/2018 Lesson Summary
Enhancing Reports
You can enhance a report by adding titles, footnotes, and column labels. Use the global TITLE statement to
define up to 10 lines of titles to be displayed at the top of the output from each procedure. Use the global
FOOTNOTE statement to define up to 10 lines of footnotes to be displayed at the bottom of the output from
each procedure.
TITLEn 'text';
FOOTNOTEn 'text';
Titles and footnotes remain in effect until you change or cancel them, or until you end your SAS session.
Use a null TITLE statement to cancel all titles, and a null FOOTNOTE statement to cancel all footnotes.
Use the LABEL statement in a PROC PRINT step to define temporary labels to display in the report instead
of variable names. Labels can be up to 256 characters in length. Most procedures use labels automatically,
but PROC PRINT does not. Use the LABEL option in the PROC PRINT statement to tell SAS to display the
labels. Alternatively, the SPLIT= option tells PROC PRINT to use the labels and also specifies a split
character to control line breaks in column headings.
SPLIT='split-character';
Sample Programs
Subsetting Your Report
Selecting Observations
https://vle.sas.com/pluginfile.php/30235/mod_scorm/content/17/m415/m415_4_a_sum.htm 2/4
14/05/2018 Lesson Summary
https://vle.sas.com/pluginfile.php/30235/mod_scorm/content/17/m415/m415_4_a_sum.htm 3/4
14/05/2018 Lesson Summary
Salary = 'Annual Salary';
run;
title;
footnote;
Close
https://vle.sas.com/pluginfile.php/30235/mod_scorm/content/17/m415/m415_4_a_sum.htm 4/4