BookmarkSubscribeRSS Feed
djrisks
Barite | Level 11

Hello,

 

Using SGPANEL in SAS 9.4, I have produced RTF output of boxplots which goes over multiple pages, and I would like to put the page numbers on the output. I have tried using the {pageof} function to add the page numbers onto the output, however this does not seem to work with SGPANEL. It works fine with Proc Report though. I think this may be because with SGPANEL, the titles go into the body of the document.

 

Below is the code I used, which is similar to my real life example.

 

proc sort data = sashelp.pricedata out = pricedata;
  by date;
run;

ods graphics / reset = all border = off width = 256mm height = 168mm;
goptions reset = all;

ods escapechar = "~";
%let ls = 100;
%let title1 = Boxplot of Sale by Quarter;
%let titt1 = %nrbquote(&title1 %sysfunc(repeat(%str( ),%eval(&ls - %length(&title1) -10))) ~{pageof});

title1 justify = left "&titt1";

ods rtf file = "C:\boxplot.rtf" style = styles.rtfplot image_dpi = 300 startpage=yes;

data pricedata2;
  set pricedata;
  quarter = qtr(date);
  year = year(date);
  quarter_year = cats("Q", quarter, "-", year);
run;

proc sgpanel data = pricedata2;
  panelby year / columns = 4 uniscale = row noheader;
  block x = quarter_year block = year / filltype=alternate novalues;
  vbox sale / category = quarter_year group = region grouporder = ascending;
  rowaxis type = log;
run;

ods rtf close;

goptions reset = all;

 

Any help will be much appreciated. If I was using a by statement then I would have used the byval variables to add the page numbers.

 

Thank you.

 

Kriss

2 REPLIES 2
DanH_sas
SAS Super FREQ

The PAGEOF function was specifically created for page numbering in the RTF pages. However, if you think that page numbering in SGPANEL would be a useful feature, you could send a suggestion to Technical Support.

 

One question that I have about this feature is the interaction between the BY statement and the PANELBY statement. Since pagination can occur within a BY group, should the page number reset for every BY-group iteration, or should the page numbers be unique across all BY-groups?

 

Thanks!
Dan 

djrisks
Barite | Level 11

Thank you for the Response Dan. I do think it is useful for SGPANEL and I will send a suggestion to Technical Support.

 

Great question, I can see an argument for both sides. For the reports that I mainly do for work though, they probably would want the page numbers to all be unique.

 

Thank you!

 

Kriss

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
  • 2 replies
  • 1013 views
  • 1 like
  • 2 in conversation