Top Banner
Priya Ramaswami Janssen R&D US
23

Priya Ramaswami Janssen R&D US. Advantages of PROC REPORT -Very powerful -Perform lists, subsets, statistics, computations, formatting within one procedure.

Jan 05, 2016

Download

Documents

Ursula Malone
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Priya Ramaswami Janssen R&D US. Advantages of PROC REPORT -Very powerful -Perform lists, subsets, statistics, computations, formatting within one procedure.

Priya RamaswamiJanssen R&D US

Page 2: Priya Ramaswami Janssen R&D US. Advantages of PROC REPORT -Very powerful -Perform lists, subsets, statistics, computations, formatting within one procedure.

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

Page 3: Priya Ramaswami Janssen R&D US. Advantages of PROC REPORT -Very powerful -Perform lists, subsets, statistics, computations, formatting within one procedure.

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>; RBREAK statement <optional>;

RUN;

Page 4: Priya Ramaswami Janssen R&D US. Advantages of PROC REPORT -Very powerful -Perform lists, subsets, statistics, computations, formatting within one procedure.

PROC REPORT statement – Common options:

• DATA= Input dataset used for processing the report• NOWD 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.

Page 5: Priya Ramaswami Janssen R&D US. Advantages of PROC REPORT -Very powerful -Perform lists, subsets, statistics, computations, formatting within one procedure.

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.

Page 6: Priya Ramaswami Janssen R&D US. Advantages of PROC REPORT -Very powerful -Perform lists, subsets, statistics, computations, formatting within one procedure.

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.

Page 7: Priya Ramaswami Janssen R&D US. Advantages of PROC REPORT -Very powerful -Perform lists, subsets, statistics, computations, formatting within one procedure.

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.

Page 8: Priya Ramaswami Janssen R&D US. Advantages of PROC REPORT -Very powerful -Perform lists, subsets, statistics, computations, formatting within one procedure.

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

Page 9: Priya Ramaswami Janssen R&D US. Advantages of PROC REPORT -Very powerful -Perform lists, subsets, statistics, computations, formatting within one procedure.
Page 10: Priya Ramaswami Janssen R&D US. Advantages of PROC REPORT -Very powerful -Perform lists, subsets, statistics, computations, formatting within one procedure.
Page 11: Priya Ramaswami Janssen R&D US. Advantages of PROC REPORT -Very powerful -Perform lists, subsets, statistics, computations, formatting within one procedure.
Page 12: Priya Ramaswami Janssen R&D US. Advantages of PROC REPORT -Very powerful -Perform lists, subsets, statistics, computations, formatting within one procedure.
Page 13: Priya Ramaswami Janssen R&D US. Advantages of PROC REPORT -Very powerful -Perform lists, subsets, statistics, computations, formatting within one procedure.

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

Page 14: Priya Ramaswami Janssen R&D US. Advantages of PROC REPORT -Very powerful -Perform lists, subsets, statistics, computations, formatting within one procedure.
Page 15: Priya Ramaswami Janssen R&D US. Advantages of PROC REPORT -Very powerful -Perform lists, subsets, statistics, computations, formatting within one procedure.
Page 16: Priya Ramaswami Janssen R&D US. Advantages of PROC REPORT -Very powerful -Perform lists, subsets, statistics, computations, formatting within one procedure.

COMPUTE BLOCKOne 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;

Page 17: Priya Ramaswami Janssen R&D US. Advantages of PROC REPORT -Very powerful -Perform lists, subsets, statistics, computations, formatting within one procedure.
Page 18: Priya Ramaswami Janssen R&D US. Advantages of PROC REPORT -Very powerful -Perform lists, subsets, statistics, computations, formatting within one procedure.
Page 19: Priya Ramaswami Janssen R&D US. Advantages of PROC REPORT -Very powerful -Perform lists, subsets, statistics, computations, formatting within one procedure.
Page 20: Priya Ramaswami Janssen R&D US. Advantages of PROC REPORT -Very powerful -Perform lists, subsets, statistics, computations, formatting within one procedure.
Page 21: Priya Ramaswami Janssen R&D US. Advantages of PROC REPORT -Very powerful -Perform lists, subsets, statistics, computations, formatting within one procedure.

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

rtf file or html file.

Syntax: ods listing close; ods rtf file = file location\file name.rtf; proc report steps from previous example ods rtf close; 

Closes output window

Opens a file for the output in rtf format

Closes rtf file

Page 22: Priya Ramaswami Janssen R&D US. Advantages of PROC REPORT -Very powerful -Perform lists, subsets, statistics, computations, formatting within one procedure.
Page 23: Priya Ramaswami Janssen R&D US. Advantages of PROC REPORT -Very powerful -Perform lists, subsets, statistics, computations, formatting within one procedure.

Contact details

Priya Ramaswami, Janssen R&D US

[email protected]