Producing Detail Reports with the PRINT Procedure |
PROC PRINT Statements |
PROC PRINT <DATA=SAS-data-set>
<option(s)>;
|
WHERE where-expression; |
starts the procedure and, when used alone, shows all variables for all observations in the SAS-data-set in the report. Other statements, that are listed below, enable you to control what to report.
You can specify the following options in the PROC PRINT statement:
names the SAS data set that PROC PRINT uses. If you omit DATA=, then PROC PRINT uses the most recently created data set.
uses variable labels instead of variable names as column headings for any variables that have labels defined. Variable labels appear only if you use the LABEL option or the SPLIT= option. You can specify labels in LABEL statements in the DATA step that creates the data set or in the PROC PRINT step. If you do not specify the LABEL option or if there is no label for a variable, then PROC PRINT uses the variable name.
shows the number of observations in the data set, in BY groups, or both and optionally specifies explanatory text to include with the number.
suppresses the observation numbers in the output. This option is useful when you omit an ID statement and do not want to show the observation numbers.
specifies the split character, which controls line breaks in column headers. PROC PRINT breaks a column heading when it reaches the split character and continues the header on the next line. The split character is not part of the column heading.
PROC PRINT uses variable labels only when you use the LABEL option or the SPLIT= option. It is not necessary to use both the LABEL and SPLIT= options because SPLIT= implies to use labels.
uses each variable's formatted width as its column width on all pages. If the variable does not have a format that explicitly specifies a field width, then PROC PRINT uses the widest data value as the column width. Without this option, PROC PRINT fits as many variables and observations on a page as possible. Therefore, the report might contain a different number of columns on each page.
produces a separate section of the report for each BY group. The BY group is made up of the variables that you specify. When you use a BY statement, the procedure expects that the input data set is sorted by the variables.
specifies a footnote. The argument n is a number from 1 to 10 that immediately follows the word FOOTNOTE, with no intervening blank, and specifies the line number of the FOOTNOTE. The text of each footnote must be enclosed in single or double quotation marks. The maximum footnote length that is allowed depends on your operating environment and the value of the LINESIZE= system option. Refer to the SAS documentation for your operating environment for more information.
enables you to report the value of a variable using a special pattern that you specify as format-name.
specifies one or more variables that PROC PRINT uses instead of observation numbers to identify observations in the report.
specifies to use labels for column headings. Variable names the variable to label, and label specifies a string of up to 256 characters, which includes blanks. The label must be enclosed in single or double quotation marks.
specifies a column header for the column that identifies each observation by number.
causes PROC PRINT to begin a new page when the variable that you specify changes value or when any variable that you list before it in the BY statement changes value. You must use a BY statement with the PAGEBY statement.
identifies the numeric variables to total in the report. You can specify a variable in the SUM statement and omit it in the VAR statement because PROC PRINT will add the variable to the VAR list. PROC PRINT ignores requests to total the BY and ID variables. In general, when you also use the BY statement, the SUM statement produces subtotals each time the value of a BY variable changes.
limits the number of sums that appear in the report. PROC PRINT reports totals only when variable changes value or when any variable that is listed before it in the BY statement changes value. You must use a BY statement with the SUMBY statement.
specifies a title. The argument n is a number from 1 to 10 that immediately follows the word TITLE, with no intervening blank, and specifies the level of the TITLE. The text of each title must be enclosed in single or double quotation marks. The maximum title length that is allowed depends on your operating environment and the value of the LINESIZE= system option. Refer to the SAS documentation for your operating environment for more information.
identifies one or more variables that appear in the report. The variables appear in the order that you list them in the VAR statement. If you omit the VAR statement, then all the variables appear in the report.
subsets the input data set by identifying certain conditions that each observation must meet before an observation is available for processing. Where-expression defines the condition. The condition is a valid arithmetic or logical expression that generally consists of a sequence of operands and operators.
PROC SORT Statements |
PROC SORT <DATA=SAS-data-set>;
|
sorts a SAS data set by the values of variables that you list in the BY statement.
specifies one or more variables by which PROC SORT sorts the observations. By default, PROC SORT arranges the data set by the values in ascending order (smallest value to largest).
SAS Macro Language |
is a macro statement that defines a macro-variable and assigns it a value. The value that you define in the %LET statement is substituted for the macro-variable in output. To use the macro-variable in a program, include an ampersand (&) prefix before it.
is an automatic macro variable that contains the date that a SAS job or session began to execute. SYSDATE9 contains a SAS date value in the DATE9 format (ddmmmyyyy). The date displays a two-digit date, the first three letters of the month name, and a four-digit year. To use it in a program, you include an ampersand (&) prefix before SYSDATE9.
Copyright © 2012 by SAS Institute Inc., Cary, NC, USA. All rights reserved.