Build reports by using ODS to create HTML, PDF, RTF, Excel, text reports and more!

proc report order of reports

Reply
New Contributor
Posts: 2

proc report order of reports

Hi,

I created this proc report, and I have a problem because the gplot that insert goes in firts page of the BY and then put the table. T'his report is in ods pdf, and the bookmark is in gplot.

 

I need put the table first and then de gplot

 

proc report data=meses contents='';
title "CUOTA POR MESES" ;
title2 '#byval1';
by REGION;
column CADENAS &ano3. Enero Febrero Marzo Abril Mayo Junio Julio Agosto Septiembre Octubre Noviembre Diciembre REGION;
FORMAT &ano3. Enero Febrero Marzo Abril Mayo Junio Julio Agosto Septiembre Octubre Noviembre Diciembre 5.1;
LABEL Enero='ENE' Febrero='FEB' Marzo='MAR' Abril='ABR' Mayo='MAY' Junio='JUN' Julio='JUL'
Agosto='AGO' Septiembre='SEP' Octubre='OCT' Noviembre='NOV' Diciembre='DIC';
define cadenas/display page contents='' ;
define REGION /group noprint;
break after REGION /contents='' page ;
FORMAT REGION REGFMT.;
compute cadenas;
if cadenas in ("TVE", "Mediaset", "Grupo A3", "AUT", "AUT PRIV", "TEMATICAS PAGO" , "Otras Cadenas", "NO IDENTIFICADO" ) then
call define(_row_,"style","style={background=AliceBlue}");
endcomp;

compute before _page_ /
style={background=CX0088EE foreground=black font_weight=bold};

if( region = 1 ) then
call define( _ROW_, "GRSEG", "work.gseg.gchart" );
else if (region = 2 ) then
call define( _ROW_, "GRSEG", "work.gseg.gchart1" );

endcomp;
FOOTNOTE h=5pt f=arial 'COPYRIGHT KANTAR MEDIA';

run;

 

I tray change compute before _page_ / for compute after _page_ / but it doesn't work

 

Thanks

Super User
Posts: 13,950

Re: proc report order of reports

Perhaps you want the gplot output in a compute after _page_ block? This is a guess without data to test.

New Contributor
Posts: 2

Re: proc report order of reports

Yes, but if I put this

compute after _page_ /
style={background=CX0088EE foreground=black font_weight=bold};

if( region = 1 ) then
call define( _ROW_, "GRSEG", "work.gseg.gchart" );
else if (region = 2 ) then
call define( _ROW_, "GRSEG", "work.gseg.gchart1" );

endcomp;

Doesn't work
SAS Super FREQ
Posts: 9,435

Re: proc report order of reports

Hi:

  Although "GRSEG" in a CALL DEFINE as the 2nd argument appears to work in some instances, it is not documented as an argument in the PROC REPORT documentation: http://go.documentation.sas.com/?docsetId=proc&docsetTarget=n1b1be5822k8nnn1s1ucv8fvpg3d.htm&docsetV... --therefore, behavior is unreliable if this is an undocumented feature or artifact from previous versions of SAS. When I use GRSEG as the 2nd argument in a COMPUTE BEFORE, it does appear to work. However, if I use GRSEG as the 2nd argument in a COMPUTE AFTER, it does NOT work for PDF, as shown below (although it does work for HTML):

grseg_work_HTML_not_PDF.png

 

On the other hand, if I make a .PNG file from my GCHART step and store that PNG file in C:\temp (where I will write both the HTML and PDF output), and then use "STYLE" as the 2nd argument with PREIMAGE=, the image insertion works in PDF and in HTML, as shown below:

style_not_grseg.png

 

If you want to continue exploring your GRSEG approach, then I would recommend working with Tech Support to find out whether this is a valid argument for all destinations or not.

 

Otherwise, using STYLE in the CALL DEFINE, seems to behave the way you want. I recommend making sure your image is the right size to fit in the cell or row where you want to place it. For another example of using images based on a particular cell value, please see the example on page 14-15 of this http://www2.sas.com/proceedings/forum2007/099-2007.pdf paper. Although the paper does show mostly using inline formatting with ODS ESCAPECHAR, it also shows a user-defined format to insert an image based on a cell value. Look at the DEFINE statement for PRODUCT. It has preimage in a TITLE statement to put the big logo at the very top of the page, but then places an image in every cell, based on the value of the PRODUCT variable:

image_with_format_report.png

 

  Hope this gives you an alternative to using "GRSEG" in your CALL DEFINE statement.

 

Cynthia

Ask a Question
Discussion stats
  • 3 replies
  • 156 views
  • 0 likes
  • 3 in conversation