I have two proc-steps within an ODS RTF. In my Procs i generate Graphics per patient and per time-period (1 to 5). Is it possible to sort the Graphics from both proc-Steps per patient in my RTF-Output? So that i have have first all Graphs from patient a, then patient b, patient c.... ? I have always different numbers of observations and my patient-IDs are not chronological.
Your issue is caused by the fact that the first procedure needs to finish ALL the BY groups before the second procedure can start. The type of "rearranging" that you are discussing -- so that all the reports/graphs for Patient A are together and then all the reports/graphs for Patient B are together is typically handled in one of two ways:
1) Use macro processing or a macro program to create multiple graphs. And, optionally, would you still want 1 RTF output file for all Patients or would you want 1 RTF output file for each Patient??? Either way, essentially, you would replace the BY group processing with a Macro program that would iterate through a list of patients so that both graphs were produced for Patient A and then both graphs for Patient B and then on and one until all the graphs were produced -- one set for each patient.
Conceptually, the general idea would be something like this:
** define the macro program;
...SAS/Graph code and other statements, like GOPTIONS, etc;
... please note that the ODS GRAPHICS ON statement is not needed or used for;
... standard PROC GPLOT procedures;
** create a single RTF file by running the macro program one time for each patient;
** a more advanced macro program would automatically generate the macro calls;
** for each patient based on a list of patients from the data.;
** This example just shows the simplest method of manually coding the macro;
** program invocation.;
ods rtf file='allpts.rtf' startpage=no;
2) Create your graphs as you do now, but store them in an ODS DOCUMENT store and then rearrange the graphical output objects to be in the structure you want using PROC DOCUMENT commands. Then replay the newly rearranged DOCUMENT store to your destination of interest.
You will probably find more information on the first, macro approach, because that has been around for a while. The second approach is a newer approach and you would have to research the ODS DOCUMENT/PROC DOCUMENT capability (and at least have SAS 9 in order to use this feature of SAS). For more information about ODS DOCUMENT, refer to the documentation and this user-group paper: http://support.sas.com/resources/papers/sgf09/318-2009.pdf
Also note that the ODS GRAPHICS statement is designed for template-based SAS/GRAPH procedures, such as SGPLOT, SGPANEL and SGSCATTER and the automatic graphs produced by SAS/STAT procedures. The use of ODS GRAPHICS ON is irrelevant in the context of "classic" device based SAS/GRAPH procedures such as PROC GPLOT.