The SAS Output Delivery System and reporting techniques

BY variable does not appear in pdf with STARTPAGE=NO statement

Reply
New Contributor
Posts: 4

BY variable does not appear in pdf with STARTPAGE=NO statement

Hi,

I am using the BY statement with SGPLOT and I want my plots to appear in a pdf file with 3 graphs in each line, which I managed with the ODS statement below. However, when I do this, I no longer get the BY variable as a title above each graphs. Strangely, some of the graphs actually has the variable starting with ID=6 and all subsequent +4 (10, 14, 18, etc). I am using SAS Enterprise Guide 7.1.


ods pdf file='C:\test.pdf' startpage=no columns=3;
proc sgplot data=reshape noautolegend;    
by ID;
   scatter x=treat y=m / yerrorlower=lower                                                                                            
                           yerrorupper=upper                                                                                            
                           markerattrs=(color=black symbol=CircleFilled)
                           errorbarattrs=(color=black);                                                                
   title1 'Log2 means with std. error bars';
xaxis label='uM HOCl (x10^2)';
yaxis label='Normalised Abundance (log2)';
run;     

 

I am open to any suggestions to circumvent this issue. Thanks in advance.

Tina

Super User
Posts: 9,856

Re: BY variable does not appear in pdf with STARTPAGE=NO statement

Could you try

 


options nobyline;
ods pdf file='C:\test.pdf' startpage=no columns=3;
title "ID= #byval1  ";
proc sgplot data=reshape noautolegend;    
by ID;
.............
New Contributor
Posts: 4

Re: BY variable does not appear in pdf with STARTPAGE=NO statement

Hi Ksharp,

 

Thank you for your suggestion.

Unfortunately, this did not solve my issue. The title-statement works when put in the SGPLOT-procedure rather than above as suggested, however, it only causes the BY-value to appear on the top of each page and not on each individual graph. 

 

Best,

Tina

 

 

SAS Super FREQ
Posts: 8,814

Re: BY variable does not appear in pdf with STARTPAGE=NO statement

Hi:

  By default, the titles should be "inside" the boundary of the graph. If you have turned that off by accident, you can always use the GTITLE option on the ODS PDF statement to get that turned back on. For example, see the example below. It is a simple scatter plot using SASHELP.CLASS, but does show the BY information and the title on every graph.

 

cynthia

use_gtitle.png

 

New Contributor
Posts: 4

Re: BY variable does not appear in pdf with STARTPAGE=NO statement

Hi Cynthia,

 

Thank you for your response, it was very helpful. It seems the GTITLE option does not quite do the trick in SAS v.7.1, but I will check with our IT-department if we have the SAS v.9 at our faculty.

 

For now, I have simply removed the STARTPAGE=NO, since the COLUMNS statement allows me to have multiple graphs on one page without losing the BY line.

 

 

Tina

SAS Super FREQ
Posts: 8,814

Re: BY variable does not appear in pdf with STARTPAGE=NO statement

Hi, When you say "SAS 7.1" you must mean Enterprise Guide 7.1. Enterprise Guide 7.1 is typically communicating with SAS 9.4. So I'm not entirely sure what you mean when you say that "GTITLE" does not "do the trick" -- you MUST specify GTITLE on the ODS PDF statement. It will not generally be used in Enterprise Guide with SASReport default output in the same way I showed with my PDF output.

cynthia
New Contributor
Posts: 4

Re: BY variable does not appear in pdf with STARTPAGE=NO statement

Hi Cynthia,

 

Yes, it is Enterprise Guide 7.1. Hmm, strangely, it does not work for me the way it should. Here is the code I used:

 

ods graphics / reset=all width=200px height=300px imagefmt=gif;                                                                             
options orientation=landscape date nonumber;
ods pdf file='\\C:\test.pdf'  columns=5 gtitle;
                                                              
proc sgplot data=reshape noautolegend;    
by ID;
   scatter x=treat y=m / yerrorlower=lower                                                                                            
                           yerrorupper=upper                                                                                            
                           markerattrs=(color=black symbol=CircleFilled)
			   errorbarattrs=(color=black);                                                                
   title1 'Log2 means with std. error bars'; 
xaxis label='uM HOCl (x10^2)'; 
yaxis label='Normalised Abundance (log2)';
run;                              
ods pdf close;

And my pdf output looks like this. So the BY line does not appear inside the graph as it did in your example. I also tried to put the GTITLE in a statement by itself, so I had  ODS PDF GTITLE; which did give the exact same result. And I tried turning ODS GRAPHICS on, but that also didn't change anything.

 

 SAS PDF output.jpg

SAS Super FREQ
Posts: 8,814

Re: BY variable does not appear in pdf with STARTPAGE=NO statement

Hi:
I am not sure why your title is outside the boundary of each graph, but on one hand, I do like yours better with just one title above all 5 graphs. However, only Tech support can replicate your environment. I ran my example in SAS 9.4 M3. I did not use EG, but with ODS statements, whether you use EG or not should not have an impact on the output. It should be the same...if your version of SAS is the same as my version of SAS. It almost looks like you have an ODS LAYOUT someplace to put the title above all 5 columns. This is a question for Tech Support, I think.

cynthia
Ask a Question
Discussion stats
  • 7 replies
  • 159 views
  • 1 like
  • 3 in conversation