Date: Fri, 20 Feb 1998 17:10:43 -0500
Reply-To: rchild@ABTI.COM
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Randy Childs <rchild@ABTI.COM>
Subject: Problem with comments
Content-Type: text/plain; charset=ISO-8859-1
Joan,
You could use PROC REPORT instead of PROC PRINT. PROC
REPORT allows you to define characteristics about how your variables are
to be displayed in the output that PROC PRINT does not. One such
characteristic
is the FLOW option. For example, suppose you had a 200 character variable
(which is the current max with SAS), you could display this variable in a
column
of width, say, 50. PROC REPORT would do all of the necessary splitting up
of
the length 200 variable to make sure that it's length on any one line of
output
was no more than 50 characters. Plus, PROC REPORT would always break
on a space so that you did not split the comment in the middle of a word.
There
are other options to that would you to suppress the printing of the other
variables
for each line that the comment used up. Here is some sample code assuming
that you have split the length 228 comment so that you have 3 observations
per
customer with the comments contained in a length 76 character variable.
DATA SAMPLE;
INFORMAT INVDATE YYMMDD6.;
INPUT #1 CUSTOMER $ 1-11 INVOICE $ 13-18 INVDATE 20-25 RESP $ 27-30
#2 COMMENT $CHAR76.;
CARDS;
12345678901 AXW321 980105 AAAA
THIS IS HOW AN EXAMPLE COMMENT WOULD LOOK IF YOU TYPED IT OUT TO THE FULL
12345678901 AXW321 980105 AAAA
EXTENT. THIS WILL SHOW YOU SOME OF THE FEATURES OF PROC REPORT. SEE THE
12345678901 AXW321 980105 AAAA
SAS MANUAL FOR PROC REPORT AS WELL AS TECHNICAL REPORT P-258.
;
RUN;
PROC PRINT DATA=SAMPLE;
RUN;
PROC REPORT DATA=SAMPLE NOWD MISSING HEADLINE HEADSKIP SPLIT='*';
COLUMN CUSTOMER INVOICE INVDATE RESP COMMENT;
DEFINE CUSTOMER / 'Customer #' WIDTH=11 RIGHT ORDER;
DEFINE INVOICE / 'Invoice #' WIDTH=9 CENTER ORDER;
DEFINE INVDATE / 'Invoice*Date' WIDTH=7 FORMAT=YYMMDD6. ORDER;
DEFINE RESP / 'Resp' WIDTH=4 LEFT ORDER;
DEFINE COMMENT / 'Inv literal comments' WIDTH=40 LEFT FLOW;
RUN;
Here is a brief explanation of some of the options and commands. The NOWD
option allows you to produce your report in non-interactive mode. Then
MISSING
option tells PROC REPORT to display rows of data even when there are missing
values for variables defined as ORDER (also GROUP and ACROSS). HEADLINE
produces a solid line that separates column labels from the actual values.
HEADSKIP leaves a blank line between the column labels and the actual
values.
SPLIT='character' is the same as the SPLIT='' used with PROC PRINT. The
COLUMN statement defines the order and selection of variables in the report
definition like the VAR statement in PROC PRINT. You must explicitly define
the
properties of each variable in the COLUMN statement. The text in quotes
gives
the same effect as using a LABEL statement in PROC PRINT. You must specify
the width of each column unless you want to accept the default. See the
above
mentioned manuals for more details on the default width. The RIGHT, LEFT,
and
CENTER options specify the justification of each column. The FLOW option
tells PROC REPORT to wrap the variable around to additional lines until the
entire
value has been displayed. There is a good amount of documentation of most
of
these options in the previously mentioned manuals. Hope this is helpful and
not
too confusing.
Randy Childs
Alpha-Beta Technology
rchild@abtispunk.com
To reply, remove the word spunk from the above address.