/* The values of the variable SURGERY are codes that indicate */
/* the type of surgery. The format $SUR. translates the surgery */
/* codes into something more meaningful. */
proc format;
value $sur
'cnt'='Controls'
'adx'='Adrenalectomy'
'ovx'='Ovariectomy'
'avx'='Adren./Ovariect.'
;
run;
/* Create the data set containing the research results. */
data mouse;
input surgery $ con brom nal morph bmor nmor;
cards;
cnt 10 5 15 15 20 12
adx 5 9 12 18 9 25
ovx 11 11 18 3 8 12
avx 15 10 10 0 5 12
;
run;
/* Create the report. */
options pagesize=30 /* Set the length of the page. */
linesize=78; /* Set the maximum line length for the page. */
data _null_;
set mouse end=eof;
/* The FILE statement uses the HEADER= */
/* option to print a standard header at the */
/* beginning of each new page. The NOTITLE */
/* option suppresses any SAS titles, date, */
/* time headers and page numbers. The output */
/* report is sent to the output window. */
file print /* Send output to the output window. */
header=H /* Every time a new page is started */
/* execute the contents of a block */
/* labeled 'H'. */
n=ps /* Readdress different parts of the page. */
linesleft=lleft /* The variable LLEFT contains the */
/* number of lines left on the page. */
notitle; /* Suppresses normal SAS titles and */
/* headers. */
/* Compare each value of an observation to find the */
/* maximum value for emphasis in the table. */
array treat(6) con brom nal morph bmor nmor;
/* Get maximum value for the observation. */
mx=max( con,brom,nal,morph,bmor,nmor);
/* Initialize column pointer control. */
/* Begin at column 30 for surgery */
/* and start counting columns from */
/* that value. */
ctr=30;
/* Use a PUT statement to output a row of the table. */
put @1 surgery $sur. @;
/* Check if the value is maximum then mark with '*'. */
do i=1 to 6;
if treat(i)=mx then
put @ctr '*' treat(i) @;
else put @ctr+1 treat(i) @;
ctr+8;
end;
put; /* Release the row of the table. */
/* Check to see if the program has reached 5 lines */
/* from the bottom of the page or the end of the data. */
/* If either condition is true, print the footnote. */
if lleft=5 or eof then
do;
put // @5
'* Represents maximum value across drug treatments
' for surgery.';
if not eof then put _page_; /* If the end of the page is */
/* reached and there is more */
/* data, then start a new page. */
end;
return;
H: /* Add title and header for each page. */
put @5 'Surgery by Drug treatment' //
@5 'C57BL6J Mice' //
;
/* Put divider line on table. */
x=repeat('-',76);
put @1 x;
/* Add column headings. */
put @1 'Surgery'
@30 'Contr.'
@37 'Bromo.'
@45 'Nalox.'
@53 'Morph.'
@61 'Br/Mor.'
@69 'Na/Mor.'
;
/* Generate divider line. */
put @1 x //;
return;
run;