BookmarkSubscribeRSS Feed
david_18
Calcite | Level 5

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

3 REPLIES 3
ballardw
Super User

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

david_18
Calcite | Level 5
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
Cynthia_sas
SAS Super FREQ

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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 684 views
  • 0 likes
  • 3 in conversation