Customize the appearance of the report produced in Example 3.8 by modifying style attributes with ODS. Replace features specific to the LISTING destination with those compatible with ODS nonlisting destinations. Send the output to a nonlisting destination.
Data Set | CARSALES |
Report Example | Example 3.8 |
Featured Step | PROC REPORT |
Featured Step Statements and Options | PROC REPORT statement ODS options: STYLE(LINES)= and STYLE(SUMMARY)= DEFINE statement ODS option: STYLE(COLUMN)= |
Output Destination of Example | RTF |
A Closer Look | Comparing Example 3.8 and Example 6.2 |
Other Examples That Use This Data Set | Examples 3.8 and 6.6 |
When you write a report program, you might need to consider the destination of the output. Some statements and options apply only to specific destinations. This example illustrates how you can change Example 3.8 to send it to a nonlisting destination instead of the LISTING destination.
The report in Example 3.8 summarized sales information by quarter for two car sales representatives and identified each sales representative’s best quarter. It also presented an annual sales summary for each sales representative and for both sales representatives combined.
A Closer Look |
The differences in the COMPUTE blocks, BREAK statement, and RBREAK statement between Example 3.8 and Example 6.2 result from the requirements of the output destinations of the two reports. The report in Example 3.8 was sent to the LISTING destination, whereas the report in Example 6.2 was sent to a nonlisting destination.
With no other programming changes, Example 3.8 sent to the RTF destination appears as shown in Figure 6.2.
The results of the LINE statements that write the separator lines do not look appropriate in this example. The COMPUTE AFTER NAME block in Example 3.8 writes values starting in specific columns. The report sent to the RTF destination was written with a style that used a proportional font, so attempts to position the values in specific columns do not work.
Table 6.2 compares the COMPUTE blocks between the two examples.
Example 3.8 | Example 6.2 |
---|---|
compute before name; bigsales=0; bigqtr=50; line @6 70*'='; endcomp; compute avgsales; avgsales = amtsold.sum / numsold.sum; endcomp; compute maxsales; if _break_=' ' and bigsales lt amtsold.sum then do; bigsales=amtsold.sum; bigqtr=month; end; endcomp; compute after name; length fullline $ 50; fullline=catx(' ','Best Quarter for', cats(name,':'), put(bigqtr,mnthfmt.)); line @6 70*'='; line @6 'Sales Totals for ' name $14. @42 numsold.sum 3. @45 amtsold.sum dollar15.2 @60 avgsales dollar15.2; line @6 fullline $50.; line @6 70*'='; line ' '; endcomp; compute after; line @6 70*'='; line @6 'Annual Totals ' @41 numsold.sum 4. @45 amtsold.sum dollar15.2 @60 avgsales dollar15.2; line @6 70*'='; line ' '; endcomp; | compute before name; bigsales=0; bigqtr=50; 1 endcomp; compute avgsales; avgsales = amtsold.sum / numsold.sum; endcomp; compute maxsales; if _break_=' ' and bigsales lt amtsold.sum then do; bigsales=amtsold.sum; bigqtr=month; end; endcomp; break after name / summarize; 2 compute after name; length fullline $ 50; fullline=catx(' ','Best Quarter for', cats(name,':'), put(bigqtr,mnthfmt.)); name=catx(' ', 3 'Sales Totals for ',name); 4 line fullline $50.; endcomp; rbreak after / summarize; 5 compute after; 6 name='Annual Totals'; endcomp; |
18.117.100.20