Entryfootnote halign=left "Output File: &prog._&ref..rtf" ;
Entryfootnote halign=left "&source" ;
proc sgrender data=graphdat
template = allgrafs ;
The GRAPHDAT data set is created by merging two data sets from different sources (but with identical structure and variable names) together just prior to the proc template step. To get this to work I have had to rename variables from the second data set. What I would like to do is simply concatenate the two data sets together and use the same variable names in both cell blocks. But to do this I would have to conditionally execute each block based on the value of a source data set variable contained in the concatenated data set. I have tried placing a if (), endif; block at various levels within each cell block but have not been able to get the 2 x 1 layout. Is there a GTL solution to this problem?
You seem to be looking for a "where clause" for each cell, and want to include only the right subset in each cell. GTL does not support such where clauses in the syntax, as it essentially duplicates this feature from SAS data step. So, your first approach is the right one. The "IF" conditional syntax in GTL is not designed for this.
Alternatively, you can use classification panels with the concatenated data, as long as the two sets are classified using another colunn. You can create a classification panel using DATALATTICE or a DATAPANEL. As long as the plots in each cell are identical, and use the simple plots such as ScatterPlot, SeriesPlot, BarChart, etc, you can do this. This is defined in the embedded LAYOUT PROTOTYPE.
You will need to assign another classifier variable (say TYPE) for the two different set of observations. In LAYOUT DATAPANEL use classvars=(type). If values for type are "MEAN" and "MEDIAN" you will get two cells with the subsets of the data. Each cell will have a cell header automatically, with the class value in it. If the cells are stacked (two rows, 1 column) the X axis will be uniform. If you don't want this, then the lattice structure should be 1 row, 2 columns.
You can probably use PROC SGPANEL to do this. SGPANEL is preferred as it will allow you to use all plot statements in the prototype, and the syntax will be very simple:
Thank you very much for your help Sanjay. I will definitely read up on DATALATTICE/DATAPANEL, but your statement "As long as the plots in each cell are identical" tells me that I should stick with the current method.
As a follow-up, there is the possibilty that the two original data sets will not have the same number of records so that after the rename and merge there are "extra" records with missing x,y and group values in the data for either the top or bottom graph. While this does not appear to effect the graphs, it does generate a phantom line in the graph legend that has no label value attached (I assume because these are the records where group is missing). Is there a way to get rid of this phantom value in the legend box if the data set being graphed cannot be conditionally executed via GTL?