You are on page 1of 43

PROC REPORT

2
Introduction
PROC REPORT is used to present data:

Tables
Listing
3
Introduction
TABLE 1
SUMMARY OF PATIENT NUMBERS AND ANALYSIS SET MEMBERSHIP
STUDY NUMBER: XXXXXXXX

____________________________________________________________________________________________________________________________________

DRUG A DRUG B Overall
____________________________________________________________________________________________________________________________________

Number of patients in the All Randomized Set 20 9 29

Number of patients in the Safety Set 20 (100%) 8 (89%) 28 (97%)

Number of patients in the Efficacy Set 17 (85%) 8 (89%) 25 (86%)

Number of patients who completed the original 12-month study 17 (85%) 8 (89%) 25 (86%)

Number of patients who did not complete the original 12-month study 3 (15%) 1 (11%) 4 (14%)

Number of patients who entered the 12-month extension study 17 (85%) 8 (89%) 25 (86%)

Number of patients who completed the 12-month extension study 15 (75%) 4 (44%) 19 (66%)

Number of patients who did not complete the 12-month extension study 2 (10%) 4 (44%) 6 (21%)
____________________________________________________________________________________________________________________________________
Produced: April 1, 2006, version 1. Page 1 of 1
Source: Listings 1 and 2.

Note: All patients who entered the 12-month extension study received DRUG B during this phase.
The All Randomized Set includes all randomized patients regardless of whether patients assigned to DRUG B were treated.
The Safety Set includes all randomized patients who received at least one dose of OGT 918 during the 24-month study period.
The Efficacy Set includes all randomized patients that entered the 12-month extended period of the study and who have at least
one post-baseline efficacy assessment during the 12-month extended period.
Percentages are based on the number of patients in the All Randomized Set in each treatment group.
Example
4
Introduction - Presenting data
There are a number of other ways of presenting
our data, such as using:

PROC PRINT
PROC TABULATE
PROC SUMMARY

5
PROC REPORT WINDOWS ENVIROMENT (WD)
Interactive windows environment.


PROC REPORT DATA = final;
RUN;




Identify variables required to be presented.


PROC REPORT DATA = final;
COLUMN page charact order statnum statist drugA drugB overall;
RUN;




6
PROC REPORT WINDOWS ENVIROMENT (WD)
7
PROC REPORT WINDOWS ENVIROMENT (WD)
8
SYNTAX
PROC REPORT <report-option list >;
BY variable-list;
COLUMN column-list;
DEFINE item<define-option-list>;
BREAK BEFORE|AFTER break-variable<break option-
list>;

COMPUTE BEFORE|AFTER <break-variable>;
LINE specification-list;
ENDCOMP;
RUN;

9
SYNTAX
PROC REPORT <report-option list >;
BY variable-list;
COLUMN column-list;
DEFINE item<define-option-list>;
BREAK BEFORE|AFTER break-variable<break option-list>;

COMPUTE BEFORE|AFTER <break-variable>;
LINE specification-list;
ENDCOMP;
RUN;

10
SYNTAX
PROC REPORT <report-option list >;
BY variable-list;
COLUMN column-list;
DEFINE item<define-option-list>;
BREAK BEFORE|AFTER break-variable<break option-list>;

COMPUTE BEFORE|AFTER <break-variable>;
LINE specification-list;
ENDCOMP;
RBREAK BEFORE|AFTER</break-option(s)>;
RUN;

11
The COLUMN statement
PROC REPORT <report-option list >;
COLUMN column-list;
RUN;

This lists the items that appear in the columns of the report and
describes the arrangement of the columns.

NOTE:
The order in which the variables are written is the order which the
variables are displayed in the report.
12
Simple PROC REPORT Example 1
TITLE1 "Proc REPORT training";
TITLE2 "Basic Proc Report";
PROC REPORT DATA=table_tr NOWD MISSING;
COLUMN order reasonn trt1 trt2 trt3;
RUN;
QUIT;
Proc REPORT training
Basic Proc Report

order reasonn trt1 trt2 trt3
1 . xx (xx.x%) xx (xx.x%) xx (xx.x%)
2 . xx (xx.x%) xx (xx.x%) xx (xx.x%)
4 1 xx (xx.x%) xx (xx.x%) xx (xx.x%)
4 2 xx (xx.x%) xx (xx.x%) xx (xx.x%)
4 3 xx (xx.x%) xx (xx.x%) xx (xx.x%)
4 4 xx (xx.x%) xx (xx.x%) xx (xx.x%)
4 5 xx (xx.x%) xx (xx.x%) xx (xx.x%)
4 6 xx (xx.x%) xx (xx.x%) xx (xx.x%)
4 7 xx (xx.x%) xx (xx.x%) xx (xx.x%)
4 8 xx (xx.x%) xx (xx.x%) xx (xx.x%)
4 9 xx (xx.x%) xx (xx.x%) xx (xx.x%)
4 10 xx (xx.x%) xx (xx.x%) xx (xx.x%)
5 . xx (xx.x%) xx (xx.x%) xx (xx.x%)
13
Exercise 1.
1. Create a simple proc report using the variables
SUBJECT
VISIT
DOB
RACE
SEX
from RAW.DEMOG.
14
The DEFINE statement
PROC REPORT <report-option list >;
COLUMN column-list;
DEFINE item /<usage>
<attributes>
<option(s)>
<justification>
<COLOR=colour>
<column-header-1 column-header-n>;
RUN;

This defines the characteristics of an item in the report. These
characteristics include the column header, the format to use to
display values, and how the PROC REPORT uses the item in the
report.
15
The DEFINE statement - <usage>
You can tell PROC REPORT how to
use a variable, by using the following on
the DEFINE statement:

/<usage>

DISPLAY - default
ORDER
GROUP
ACROSS
ANALYSIS
COMPUTED

16
The DEFINE statement <usage>
DISPLAY default
This defines the item, which must be a data set variable, as a display
variable. (These do not affect the order of the rows in the report. The
order of the rows reflects the order of the observations in the data set.)

ORDER
This defines the item as an order variable.

GROUP
The defines the item as a group variable.


17
Using DEFINE Example 2
TITLE2 "Using DEFINE statements";
TITLE3 "Ordering the output using our Primary and
Secondary order variables";
PROC REPORT DATA=table_tr NOWD MISSING;
COLUMN order reasonn trt1 trt2 trt3;
DEFINE order / ORDER;
DEFINE reasonn / ORDER;
DEFINE trt1 / DISPLAY;
DEFINE trt2 / DISPLAY;
DEFINE trt3 / DISPLAY;
RUN;
QUIT;
Using DEFINE statements
Ordering the output using our Primary and Secondary order variables

order reasonn trt1 trt2 trt3
1 . xx (xx.x%) xx (xx.x%) xx (xx.x%)
2 . xx (xx.x%) xx (xx.x%) xx (xx.x%)
4 1 xx (xx.x%) xx (xx.x%) xx (xx.x%)
2 xx (xx.x%) xx (xx.x%) xx (xx.x%)
3 xx (xx.x%) xx (xx.x%) xx (xx.x%)
4 xx (xx.x%) xx (xx.x%) xx (xx.x%)
5 xx (xx.x%) xx (xx.x%) xx (xx.x%)
6 xx (xx.x%) xx (xx.x%) xx (xx.x%)
7 xx (xx.x%) xx (xx.x%) xx (xx.x%)
8 xx (xx.x%) xx (xx.x%) xx (xx.x%)
9 xx (xx.x%) xx (xx.x%) xx (xx.x%)
10 xx (xx.x%) xx (xx.x%) xx (xx.x%)
5 . xx (xx.x%) xx (xx.x%) xx (xx.x%)
18
The DEFINE statement <attributes>
One of more attribute can be given to each defined
item:

/<attributes>

FORMAT
ORDER=DATA|FORMATTED|FREQ|INTERNAL
SPACING
WIDTH
19
The DEFINE statement <attributes>
FORMAT=format
This assigns the SAS or user-defined format to the item.

ORDER=DATA|FORMATTED|FREQ|INTERNAL
The ORDER= option specifies the order in which the class variable values
are displayed in each table. (Default value for order is FORMATTED).

Possible values for order are as follows:
INTERNAL the class values are ordered by the internal
representation of the values.
FREQ the class values are ordered by descending frequency
count.
DATA the class values are kept in the order they were
encountered in the data set.
FORMATTED the class values are ordered by the formatted value.




20
The DEFINE statement <attributes>
SPACING=horizontal-positions [ Default=2]
This defines the number of blank characters to leave between the
column defined and the column immediately left.

WIDTH=column-width
This defines the width of the column in which PROC REPORT
displays the item.


Note: The sum of the column widths plus the spacing in the
report can not exceed the line size.

21
The DEFINE statement <Options>
One of more option(s) can be given to each defined
item:

/<option(s)>

DESCENDING
FLOW
ID
NOPRINT
NOZERO
PAGE

22
The DEFINE statement <Options>
DESCENDING
Reverses the order in which the rows or values are displayed.

FLOW
Wraps the value of a character variable in its column

ID
Specifies that the item you are defining is an ID variable.

NOPRINT
Use if you want to display a variable in the report but need it to calculate
other values particular used for ordering.

NOZERO
Suppresses the display of the variable if the values are all zero or missing.

PAGE
Inserts a page break just before printing the first column containing
values.


23
The DEFINE statement <justification>
One of the following can be given to each defined
item:

/<justification>

CENTER
LEFT
RIGHT - default
24
Using DEFINE Example 4
TITLE3 "Using ORDER/REASONN variables to order output. Use DISCREAS to identify each row of table";
PROC REPORT DATA=table_tr NOWD MISSING;
COLUMN order reasonn discreas trt1 trt2 trt3;
DEFINE order / ORDER NOPRINT;
DEFINE reasonn / ORDER NOPRINT;
DEFINE discreas / DISPLAY "REASON FOR DISCONTINUATION";
DEFINE trt1 / DISPLAY DRUG A";
DEFINE trt2 / DISPLAY DRUG B";
DEFINE trt3 / DISPLAY "TOTAL";
RUN;
QUIT;

Basic Proc Report
Using ORDER/REASONN variables to order output. Use DISCREAS to identify each row of table

REASON FOR DISCONTINUATION DRUG A DRUG B TOTAL
Number of subjects xx (xx.x%) xx (xx.x%) xx (xx.x%)
Number of subjects who completed the entire trial xx (xx.x%) xx (xx.x%) xx (xx.x%)
Primary reasons for premature discontinuation
Primary reasons for premature discontinuation
Did not meet screening assessments xx (xx.x%) xx (xx.x%) xx (xx.x%)
Withdrawn by investigator xx (xx.x%) xx (xx.x%) xx (xx.x%)
Withdrew consent xx (xx.x%) xx (xx.x%) xx (xx.x%)
Adverse Events xx (xx.x%) xx (xx.x%) xx (xx.x%)
Lack of therapeutic response xx (xx.x%) xx (xx.x%) xx (xx.x%)
Lost to follow-up xx (xx.x%) xx (xx.x%) xx (xx.x%)
Death xx (xx.x%) xx (xx.x%) xx (xx.x%)
Medication non-compliance xx (xx.x%) xx (xx.x%) xx (xx.x%)
Clinically significant test results xx (xx.x%) xx (xx.x%) xx (xx.x%)
Other xx (xx.x%) xx (xx.x%) xx (xx.x%)
Total number of withdrawals: xx (xx.x%) xx (xx.x%) xx (xx.x%)
25
Using DEFINE Example 5
TITLE3 "Using the SPACING & WIDTH options to "spread" the table over a width of 132";
PROC REPORT DATA=table_tr NOWD MISSING HEADLINE HEADSKIP ;
COLUMN order reasonn ("--" discreas ("- TREATMENT GROUP -" trt1 trt2) trt3);
DEFINE order / ORDER NOPRINT;
DEFINE reasonn / ORDER NOPRINT;
DEFINE discreas / DISPLAY "REASON FOR DISCONTINUATION" WIDTH=51;
DEFINE trt1 / DISPLAY DRUG A" WIDTH=15;
DEFINE trt2 / DISPLAY DRUG B" WIDTH=15 SPACING=15;
DEFINE trt3 / DISPLAY "TOTAL" WIDTH=15 SPACING=19;
RUN;
QUIT;
Basic Proc Report
Using the SPACING & WIDTH options to spread the table over a width of 132


TREATMENT GROUP
REASON FOR DISCONTINUATION DRUG A DRUG B TOTAL


Number of subjects xx (xx.x%) xx (xx.x%) xx (xx.x%)
Number of subjects who completed the entire trial xx (xx.x%) xx (xx.x%) xx (xx.x%)
Primary reasons for premature discontinuation
Primary reasons for premature discontinuation
Did not meet screening assessments xx (xx.x%) xx (xx.x%) xx (xx.x%)
Withdrawn by investigator xx (xx.x%) xx (xx.x%) xx (xx.x%)
Withdrew consent xx (xx.x%) xx (xx.x%) xx (xx.x%)
Adverse Events xx (xx.x%) xx (xx.x%) xx (xx.x%)
Lack of therapeutic response xx (xx.x%) xx (xx.x%) xx (xx.x%)
Lost to follow-up xx (xx.x%) xx (xx.x%) xx (xx.x%)
Death xx (xx.x%) xx (xx.x%) xx (xx.x%)
Medication non-compliance xx (xx.x%) xx (xx.x%) xx (xx.x%)
Clinically significant test results xx (xx.x%) xx (xx.x%) xx (xx.x%)
Other xx (xx.x%) xx (xx.x%) xx (xx.x%)
Total number of withdrawals: xx (xx.x%) xx (xx.x%) xx (xx.x%)
26
Using DEFINE Example 6
TITLE3 "Using the SPILT option to gain extra lines in the header";
PROC REPORT DATA=table_tr NOWD MISSING HEADLINE HEADSKIP SPLIT='~' SPACING=16 LS=132 PS=40;
COLUMN order reasonn ("--" discreas ("~- TREATMENT GROUP -" trt1 trt2) trt3);
DEFINE page / ORDER NOPRINT;
DEFINE order / ORDER NOPRINT;
DEFINE reasonn / ORDER NOPRINT;
DEFINE discreas / DISPLAY "~~REASON FOR DISCONTINUATION~ " WIDTH=51 SPACING=2 RIGHT;
DEFINE trt1 / DISPLAY "DRUG A~ " WIDTH=12 SPACING=10 ;
DEFINE trt2 / DISPLAY "DRUG B~ " WIDTH=12 ;
DEFINE trt3 / DISPLAY "~~TOTAL~ " WIDTH=15;
RUN;
QUIT;
Basic Proc Report
Using the SPILT option to gain extra lines in the header



TREATMENT GROUP
REASON FOR DISCONTINUATION DRUG A DRUG B TOTAL



Number of subjects xx (xx.x%) xx (xx.x%) xx (xx.x%)
Number of subjects who completed the entire trial xx (xx.x%) xx (xx.x%) xx (xx.x%)
Primary reasons for premature discontinuation
Primary reasons for premature discontinuation
Did not meet screening assessments xx (xx.x%) xx (xx.x%) xx (xx.x%)
Withdrawn by investigator xx (xx.x%) xx (xx.x%) xx (xx.x%)
Withdrew consent xx (xx.x%) xx (xx.x%) xx (xx.x%)
Adverse Events xx (xx.x%) xx (xx.x%) xx (xx.x%)
Lack of therapeutic response xx (xx.x%) xx (xx.x%) xx (xx.x%)
Lost to follow-up xx (xx.x%) xx (xx.x%) xx (xx.x%)
Death xx (xx.x%) xx (xx.x%) xx (xx.x%)
Medication non-compliance xx (xx.x%) xx (xx.x%) xx (xx.x%)
Clinically significant test results xx (xx.x%) xx (xx.x%) xx (xx.x%)
Other xx (xx.x%) xx (xx.x%) xx (xx.x%)
Total number of withdrawals: xx (xx.x%) xx (xx.x%) xx (xx.x%)
27
Exercise 2.
2. Using the following variables from RAW.PHYSEX
SUBJECT,
VISIT,
VISDAT,
PEXCAT,
NORMABN
Create a proc report which is ordered by SUBJECT, VISIT and VISDAT and
where the other variables are displayed.

2.A. Define the variable VISDAT by using the attribute Internal.

2.B. Also display the variable COMMNT on the proc report. Define the following
widths for each variable with a spacing of 2.

SUBJECT=8, VISIT=21, VISDAT=12, PEXCAT=30, NORMABN=15, COMMNT=36.

2.C. Apply the following column labels to each variable.
SUBJECT=Subject,
VISIT=Visit,
VISDAT=Visit Date,
PEXCAT=Examination,
NORMABN=Normal/Abnormal
COMMNT=Comments.
28
The BREAK statement
PROC REPORT <report-option list >;
COLUMN column-list;
DEFINE item /<usage>
<attributes>
<option(s)>
<justification>
<COLOR=colour>
<column-header-1 column-header-n>;
BREAK BEFORE|AFTER break-variable /<break-option-list>;
RUN;

BREAK creates a default summary at a break. A break is a
change in the value of a group or order variable.
29
The BREAK statement location
The location controls the placements of the break lines.

location

AFTER - places the break lines immediately after the last
row of each set of rows that have the same
value for the break-variable.

BEFORE - places the break lines immediately before the first
row of each set of rows that have the same
value for the break-variable.



30
The BREAK statement break-variable
break-variable

The break-variable is a GROUP or ORDER variable.
The REPORT procedure writes break lines each time the
value of this variable changes.
31
The BREAK statement <break-option(s)>
One of more attribute can be given to each defined item:

/<break-option(s)>

SKIP
PAGE
DUL
DOL
UL
OL
SUMMARIZE
SUPRESS
COLOR=colour


32
The BREAK statement <break-option(s)>

SKIP - this writes a blank line for the last break line.
PAGE this starts a new page after the last break line.

DUL double underlining (default is = )
DOL - double overlining (default is = )

UL single underlining (default is - )
OL - single overlining (default is - )

SUMMARIZE this writes a summary line in each group of break lines.

SUPRESS this suppresses printing of :
1. The value of the break variable in the summary line.
2. Any underlining and overlining in the break lines in the column containing the
break variable.

COLOR=colour

33
Using BREAK Example 8
Basic Proc Report
Using the BREAK AFTER block statement to add blank lines after each ORDER variable change


TREATMENT GROUP
REASON FOR DISCONTINUATION DRUG A DRUG B TOTAL


Number of subjects xx (xx.x%) xx (xx.x%) xx (xx.x%)

Number of subjects who completed the entire trial xx (xx.x%) xx (xx.x%) xx (xx.x%)

Primary reasons for premature discontinuatios

Did not meet screening assessments xx (xx.x%) xx (xx.x%) xx (xx.x%)
Withdrawn by investigator xx (xx.x%) xx (xx.x%) xx (xx.x%)
Withdrew consent xx (xx.x%) xx (xx.x%) xx (xx.x%)
Adverse Events xx (xx.x%) xx (xx.x%) xx (xx.x%)
Lack of therapeutic response xx (xx.x%) xx (xx.x%) xx (xx.x%)
Lost to follow-up xx (xx.x%) xx (xx.x%) xx (xx.x%)
Death xx (xx.x%) xx (xx.x%) xx (xx.x%)
Medication non-compliance xx (xx.x%) xx (xx.x%) xx (xx.x%)
Clinically significant test results xx (xx.x%) xx (xx.x%) xx (xx.x%)
Other xx (xx.x%) xx (xx.x%) xx (xx.x%)

Total number of withdrawals: xx (xx.x%) xx (xx.x%) xx (xx.x%)

TITLE3 "Using the BREAK AFTER block statement to add blank lines after each ORDER variable change";
PROC REPORT DATA=table_tr NOWD MISSING HEADLINE HEADSKIP;
COLUMN order reasonn ("--" discreas ("- TREATMENT GROUP -" trt1 trt2) trt3);
DEFINE order / ORDER NOPRINT;
DEFINE reasonn / ORDER NOPRINT;
DEFINE discreas / DISPLAY "REASON FOR DISCONTINUATION";
DEFINE trt1 / DISPLAY DRUG A";
DEFINE trt2 / DISPLAY DRUG B";
DEFINE trt3 / DISPLAY "TOTAL";

BREAK AFTER order / SKIP;
RUN;
QUIT;

1
2
3
4
5
34
The BY statement
PROC REPORT <report-option list >;
BY<DESCENDING> variable-n <NOTSORTED>
COLUMN column-list;
DEFINE item /<usage>
<attributes>
<option(s)>
<justification>
<COLOR=colour>
<column-header-1 column-header-n>;
BREAK BEFORE|AFTER break-variable /<break-option-list>;
RBREAK BEFORE|AFTER </break-options>;
RUN;

PROC REPORT expects the data set to be sorted in order of the BY variables.

NOTE: The BY statement can not be used in the windowing environment.
35
Exercise 3.

3. Include a break after each visit.

3.A. Create a break before each subject and a
break after each page.
36
The COMPUTE statement
PROC REPORT <report-option list >;
COLUMN column-list;
DEFINE item /<usage>
<attributes>
<option(s)>
<justification>
<COLOR=colour>
<column-header-1 column-header-n>;
BREAK BEFORE|AFTER break-variable /<break-option-list>;

COMPUTE BEFORE|AFTER <break-variable>;
LINE specification(s);
ENDCOMP;
COMPUTE report-item </type-specification>;
CALL DEFINE (column-id, attribute-name,value);
ENDCOMP;

RUN;

A compute block contains one or more programming statements that PROC
REPORT executes as it builds the report.
An ENDCOMP statement must mark the end of the group of statements in
the compute block.
37
The COMPUTE statement location
The location determines where the compute block executes.

location

AFTER - executes the compute block immediately after the
last row of each set of rows that have the same
value for the break-variable.

BEFORE - executes the compute block immediately before
the last row of each set of rows that have the
same value for the break-variable.



38
The COMPUTE statement report-item
report-item

This specifies a data set variable, a computed variable
or statistic to associate the block with.

The report-item must be included in the COLUMN
statement.

Also if the report-item is a computed variable this must
be included in the DEFINE statement too.

39
Using a COMPUTE BLOCK Example 9
TITLE3 "Using the COMPUTE AFTER block statement to add a footer. A PAGE variable is needed to control this";
PROC REPORT DATA=table_tr NOWD MISSING HEADLINE HEADSKIP;
BY page;
COLUMN page order reasonn ("--" discreas ("- TREATMENT GROUP -" trt1 trt2) trt3);
DEFINE page / ORDER NOPRINT;
DEFINE order / ORDER NOPRINT;
DEFINE reasonn / ORDER NOPRINT;
DEFINE discreas / DISPLAY "REASON FOR DISCONTINUATION";
DEFINE trt1 / DISPLAY DRUG A";
DEFINE trt2 / DISPLAY DRUG B";
DEFINE trt3 / DISPLAY "TOTAL";

BREAK AFTER order / SKIP;

COMPUTE AFTER page;
uline = REPEAT("-",132);
foot = "O:\TRAINING\SAS\PROC REPORT\Using the COMPUTE block.sas";

LINE @1 uline $132.;
LINE @1 " ";
LINE @1 132*'_';
LINE @1 " ";
LINE @1 foot $132.;
ENDCOMP;
RUN;
QUIT;
40
Using a COMPUTE BLOCK Example 9 cont.
Using DEFINE statements
Using the COMPUTE AFTER block statement to add a footer. A PAGE variable is needed to control this


TREATMENT GROUP
REASON FOR DISCONTINUATION DRUG A DRUG B TOTAL


Number of subjects xx (xx.x%) xx (xx.x%) xx (xx.x%)

Number of subjects who completed the entire trial xx (xx.x%) xx (xx.x%) xx (xx.x%)

Primary reasons for premature discontinuation

Did not meet screening assessments xx (xx.x%) xx (xx.x%) xx (xx.x%)
Withdrawn by investigator xx (xx.x%) xx (xx.x%) xx (xx.x%)
Withdrew consent xx (xx.x%) xx (xx.x%) xx (xx.x%)
Adverse Events xx (xx.x%) xx (xx.x%) xx (xx.x%)
Lack of therapeutic response xx (xx.x%) xx (xx.x%) xx (xx.x%)
Lost to follow-up xx (xx.x%) xx (xx.x%) xx (xx.x%)
Death xx (xx.x%) xx (xx.x%) xx (xx.x%)
Medication non-compliance xx (xx.x%) xx (xx.x%) xx (xx.x%)
Clinically significant test results xx (xx.x%) xx (xx.x%) xx (xx.x%)
Other xx (xx.x%) xx (xx.x%) xx (xx.x%)

Total number of withdrawals: xx (xx.x%) xx (xx.x%) xx (xx.x%)

------------------------------------------------------------------------------------------------------------------------------------

____________________________________________________________________________________________________________________________________

O:\TRAINING\SAS\PROC REPORT\Using the COMPUTE block.sas
41
Using a COMPUTE BLOCK Example 10
PROC REPORT DATA=final SPLIT='~' SPACING=3 NOWD MISSING;
COLUMN page ('__~ ' charact order statnum statist DRUG_A DRUG_Boverall comp_total);
DEFINE page / ORDER NOPRINT;
DEFINE order / ORDER NOPRINT;
DEFINE charact / ORDER order=internal WIDTH=30 LEFT f=charac. 'Characteristic ';
DEFINE statnum / ORDER order=internal NOPRINT;
DEFINE statist / DISPLAY WIDTH=20 LEFT 'Statistic';
DEFINE DRUG_A / DISPLAY WIDTH=20 LEFT f=$20. DRUG A';
DEFINE DRUG_B / DISPLAY WIDTH=20 LEFT f=$20. DRUG B';
DEFINE overall / DISPLAY WIDTH=10 LEFT f=$10. 'Overall';
DEFINE comp_total /COMPUTED WIDTH=10 LEFT 'Computed Overall';

BREAK BEFORE charact / SKIP;
BREAK AFTER page / PAGE;

COMPUTE BEFORE page;
LINE @1 132*'_';
ENDCOMP;

COMPUTE comp_total;
if order in( 1 2 5 7) then comp_total= input(DRUG_A,8.) + input(DRUG_B,8.);
ENDCOMP;

COMPUTE AFTER page;
LINE @1 132*'_';
%produced(pagevar=page,totvar=&totpage,version=1);
LINE @1 'Source: Listing 5.';
LINE @1 ' ';
LINE @1 'Note: Percentages are based on the number of patients in the All Randomized Set with non-missing values for each characteristic,';
LINE @1 ' in each treatment group.';
LINE @1 ' Summary statistics are based on gender, race and date of birth recorded at Screening Visit 1.';
LINE @1 ' Age is calculated at randomization date.';
ENDCOMP;
RUN;
42
Using a COMPUTE BLOCK Example 10 cont.


Example of a COMPUTE block
____________________________________________________________________________________________________________________________________

Computed
Characteristic Statistic DRUG A DRUG B Overall Overall
____________________________________________________________________________________________________________________________________

Total number of patients N 21 9 30 30

Gender N 21 9 30 30
Male 10 (48%) 2 (22%) 12 (40%
Female 11 (52%) 7 (78%) 18 (60%

Age (years) N 21 9 30
Mean 10.4 9.9 10.2
SD 5.1 4.0 4.8
Median 8.0 9.0 8.5
Minimum 2 6 2
Maximum 19 20 20

Age group (years) N 21 9 30 30
2 - 11 11 (52%) 8 (89%) 19 (63%
12 - 17 7 (33%) 0 7 (23%
>= 18 3 (14%) 1 (11%) 4 (13%

Race N 21 9 30 30
White 11 (52%) 4 (44%) 15 (50%
Black 2 (10%) 2 (22%) 4 (13%
Asian (Oriental) 1 (5%) 0 1 (3%
Asian (Other) 2 (10%) 2 (22%) 4 (13%
Hispanic 4 (19%) 1 (11%) 5 (17%
Other 1 (5%) 0 1 (3%
____________________________________________________________________________________________________________________________________
Produced: September 29, 2006, version 1. Page 1 of 1
Source: Listing 5.

Note: Percentages are based on the number of patients in the All Randomized Set with non-missing values for each characteristic,
in each treatment group.
Summary statistics are based on gender, race and date of birth recorded at Screening Visit 1.
Age is calculated at randomization date.
43
Exercise 4.
4. Create a line before and after each page.

4.B. Include a headskip and a line at the very top of
each page.

You might also like