I am relatively new to SAS/SAS-EG (about 5 months) so please bear with me if I have overlooked a simple solution.
Question 1: Is there a way in to force a List Report RTF output to one page width?
Please note: I have set the page orientation to landscape and have added headers/footers using the "Custom Code," if that would have any effect on potential solutions
Question 2: I would like to specify the internal order of a column in the Listing Report. I set the order using "Sort By" and it is correct in the Query, buy when I run the List Report Wizard, the column's values are rest to alphabetical order. For example:
Which is what I want. However, when I run the List Report Wizard I get:
Is there a way to force the C-A-B order to be preserved in the List Report?
Thank you in advance for any solutions or suggestions.
By default, PROC REPORT, (which is the procedure "underneath" the List Report Wizard, will display items using the default ordering. Using code, there is a way to specify ORDER=DATA if your data have been pre-sorted to be the order you want.
However, in the List Report Wizard, I do not believe there is a way to alter the PROC REPORT code. If you edit the code created by the EG List Report Wizard, then you would have to change the DEFINE statement for your variable of interest. For example, if I had created a report using SASHELP.CLASS and I had already pre-sorted the data so that SEX and NAME were ordered in descending order, then I could tell PROC REPORT to preserve that order by changing the DEFINE statements to include ORDER=DATA:
proc report .....;
column Sex Name Height Age ;
define Sex / group 'Sex' missing order=data;
define Name / order order=data;
.... more code ....
PS...ODS RTF destination output does not have the concept of "fit to page". Generally, ODS does not have a good way to interact with Microsoft Office menus and menu buttons. However, if you changed your output type to PDF output, then there are some system options that will allow you to instruct Acrobat Reader to fit the output to the page width. For example, if you look at the documentation, then you will see that this option causes the Adobe Acrobat Reader to open in "fit to page" mode.
You would use the option like this:
options pdfpageview=fitpage orientation=landscape;
ods pdf file='c:\temp\fitpage.pdf';
proc report data=sashelp.class nowd;
column sex name age height;
title 'List of Students and the Overall Average Age and Height';
define sex / group;
define name / order;
define age / mean;
define height / mean;
rbreak after/ summarize;
ods pdf close;
Thank you very much for your response. Including the ORDER=DATA in the DEFINE statement resolved the issue. However, do you know if there is a way to make that a default, perhaps in the Custom Code section? Or will I simply have to edit the code for the program itself? (I ask because I have a few programs that have this issue, and hope to avoid having to amend all of the define statements individually).
The client prefers the output in a RTF file, but your PDF solution does work. Perhaps I can change their minds.
Thank you again for the solutions, I appreciate the help.
The thing is that PROC REPORT produces EACH report starting from the defaults. And, there are some reports where you might want those defaults. One of the benefits of using PROC REPORT is that you do not, necessarily, need to pre-sort the data, because if you ask for an item to be of ORDER or GROUP usage, then PROC REPORT will invoke a sort behind the scenes, if it needs to.
The bottom line is that there is no way to set ORDER=DATA as a default for PROC REPORT. You would have to modify the code in the DEFINE statement each time. The reason for this is that you can only use ORDER=DATA for DEFINE statements where the item is an ORDER or GROUP item -- so in some LIST REPORT generated code, if the item has an ANALYSIS or DISPLAY usage, then ORDER=DATA would be an incorrect option.
Of course, once you have your modified code, you can use it inside your project by using File-->Open Program.
The underlying assumptions of RTF and PDF are different. For RTF output, the default assumption is that the end-user will be using Microsoft Word as the report viewer and that, in addition to merely -viewing- the RTF document, Word makes the document -editable- which means that there might be some post-creation editing and tweaking of the document taking place. So, the ability to set Word-specific menu options was not implemented because (#1) if the RTF file is going to undergo changes, then setting margins, applying passwords or setting View options are only a few of the Office-specific changes you might want to make. In addition, ( #2) not everybody uses Microsoft Word to view and edit RTF files -- so any Office-specific option would not work in other word processing programs.
On the other hand, the underlying assumption of PDF is that you want the document to look as it will look when it is sent to a printer. Since Adobe Acrobat Reader does not allow editing of the document and since, in addition to sending the document to a printer, your end-user will probably be using Acrobat Reader as the viewer of choice, there are some PDF specific system options that will have an impact on ODS PDF output when the output is opened in Reader. Beginning in SAS 9.2, the "PDF" system options, such as PDFPAGEVIEW allow that level of interaction with Adobe Reader.
If there is no "post-creation" editing that is taking place, then you might want to investigate ODS PDF. In addition to the PDF specific system options, there are some COMPRESS options on the ODS PDF invocation statement that will make the file smaller, when stored on a server. And, there are are "bookmark" control options that will control the creation and display of Acrobat Reader bookmarks. For example:
ods pdf file='c:\temp\pdfopt.pdf' compress=9 bookmarkgen=yes boomarklist=hide;
...will put the highest level of compression on the PDF document. And although bookmarks will be created (bookmarkgen=yes), the initial PDF display will open with the bookmarks hidden (bookmarklist=hide). These are pretty cool features of ODS PDF that are not available with ODS RTF -- basically because the underlying assumptions of PDF dictate that everything seen in the "viewer" is not easily changeable by the end-user and must be set at file creation time.