ARE YOU USING PROC REPORT YET Priya Ramaswami

  • Slides: 23
Download presentation
ARE YOU USING PROC REPORT YET? Priya Ramaswami Janssen R&D US

ARE YOU USING PROC REPORT YET? Priya Ramaswami Janssen R&D US

Advantages of PROC REPORT Very powerful - Perform lists, subsets, statistics, computations, formatting within

Advantages of PROC REPORT Very powerful - Perform lists, subsets, statistics, computations, formatting within one procedure. - Multiple functions in one – SORT, PRINT, MEANS, TABULATE, some DATA STEP processing

SYNTAX PROC REPORT data=input dataset options; WHERE <optional>; COLUMN list of variables; DEFINE variable

SYNTAX PROC REPORT data=input dataset options; WHERE <optional>; COLUMN list of variables; DEFINE variable 1 / column attributes; DEFINE variable 2 / column attributes; …. DEFINE last variable / column attributes; COMPUTE block <optional>; BREAK statement <optional>; RUN;

PROC REPORT statement – Common options: • DATA= • NOWD Input dataset used for

PROC REPORT statement – Common options: • DATA= • NOWD Input dataset used for processing the report Short for NOWINDOWS. Sends the report to the output window instead of the interactive REPORT window • SPLIT= Wraps the header and column contents at the specified character. The default character is ‘/’ • HEADLINE Creates a line below the column header • HEADSKIP Inserts a blank line between the column header and the first line of data • OUT= Creates an output dataset with the contents of the REPORT procedure. This is especially helpful while trouble-shooting any new variables created in the COMPUTE block or specified breaks.

WHERE statement - subset the data. Syntax: keyword WHERE + conditions COLUMN statement -

WHERE statement - subset the data. Syntax: keyword WHERE + conditions COLUMN statement - lists all the variables to be displayed in the report, including variables created in the COMPUTE block Syntax: keyword COLUMN + variable names.

DEFINE statement - how the variables are presented in the report. Syntax: keyword DEFINE

DEFINE statement - how the variables are presented in the report. Syntax: keyword DEFINE + variable name + slash (/) + set of keywords and options. Common keywords: – GROUP categorizes observations by the variable – DISPLAY default; displays values for each observation as they appear in the data. – ORDER sorts the data by the variable – ANALYSIS performs the specified statistical function on the variable – COMPUTED identifies variables created in the COMPUTE block.

COMPUTE block - begins with the COMPUTE statement and ends with the ENDCOMP statement.

COMPUTE block - begins with the COMPUTE statement and ends with the ENDCOMP statement. Create new variables, add blank lines, add footnotes. BREAK statement is optional and is used for summarizing groups of data. Syntax: BREAK before or after variable / <options>; BREAK variable has to be a group or order variable. A summary line is created when the value of the variable changes. The keyword BEFORE creates the summary line before the data; the keyword AFTER creates the summary line after the data.

RBREAK statement is optional and is used to create a summary line for the

RBREAK statement is optional and is used to create a summary line for the whole report. Syntax: RBREAK before or after / <options>; Options for the BREAK and RBREAK statements: - UL Underline OL Overline - DUL Double underline - DOL Double overline - PAGE Skip a page before the next row - SKIP Skip a line before the next row - SUMMARIZE Create a summary line for each variable specified - SUPPRESS Not print the value of the break variable in the summary line

ORDER= Option Specifies the method of sorting the variable. Used in conjunction with the

ORDER= Option Specifies the method of sorting the variable. Used in conjunction with the ORDER keyword in the DEFINE statement. There are four types of sorts that can be performed with the ORDER= option. • ORDER=INTERNAL Sorts by the variable’s unformatted values • ORDER=DATA Sorts by the order of the variable’s values as in the dataset • ORDER=FORMATTED Default; Sorts by the variable’s formatted values • ORDER=FREQ Sorts by the frequency counts of the variable’s values

COMPUTE BLOCK One of the most unique features of the REPORT procedure. Enables to

COMPUTE BLOCK One of the most unique features of the REPORT procedure. Enables to modify values, add variables, add headers and footnotes, and control the contents of columns. The COMPUTE block begins with the COMPUTE statement and ends with the ENDCOMP statement. Typically placed after the DEFINE statements. 2 types of COMPUTE blocks: associated with a location with respect to the layout of the report associated with the report item only. Syntax: compute <location> <report item> </ options>; executable statements endcomp;

OUTPUT DELIVERY SYSTEM (ODS) Output from the PROC REPORT can be directed to a

OUTPUT DELIVERY SYSTEM (ODS) Output from the PROC REPORT can be directed to a pdf file, rtf file or html file. Closes output Syntax: window ods listing close; ods rtf file = file locationfile name. rtf; proc report steps from previous example ods rtf close; Opens a file for the output in rtf format Closes rtf file

Contact details Priya Ramaswami, Janssen R&D US pramaswa@its. jnj. com

Contact details Priya Ramaswami, Janssen R&D US pramaswa@its. jnj. com