BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
BenKra
Calcite | Level 5

I am running SAS 9.4 TS Level 1M0 on a X64_8HOME platform, Windows Version 6.2.9200.

When a plot is printed to pdf the line-width in the graphic is reduced to 1. (Exporting manually as enhanced metafile displays the correct line-width but there is poor resolution of text.)

I tried with different output styles but there was no difference, nor could I find an option to change default line-width in output styles. Changing paper size did not solve the problem, either, as line width only changed marginally when choosing larger format.

Is there any way to get a correct line width for SAS-plots in pdf? (the code below is part of a macro, I had to remove part of it as it concerns unpublished research, the same is true for the figures)

/* Close the listing destination */
ods listing close;

options orientation=landscape;
/* Reset the graphics options  */
goptions reset=all;

/* Modify the PDF page properties. These options must
   be set before the ODS PDF statement is executed. */
options
   
   papersize=A4
   ;

/* Open the PDF destination */
ods pdf style=seaside DPI=1200
   file= &outputfile  /* Output filename */ 
   compress=0          /* No compression */                

  
   /* define symbol characteristics */ 
symbol6 color=blue        interpol=join width=4 value=dot height=2.5; 
symbol5 color=lightgreen  interpol=join width=4 value=dot height=2.5; 
symbol4 color=crimson     interpol=join width=4 value=dot height=2.5; 
symbol3 color=gold        interpol=join width=4 value=dot height=2.5; 
symbol2 color=pink        interpol=join width=4 value=dot height=2.5; 
symbol1 color=lightgray   interpol=join width=4 value=dot height=2.5; 


 ...

title1 height=3 color = &Col_title &Titel_1; 
proc gplot data=&BasTab_03&VariabelBas ; 
   plot  (&mean_&Kvot_&man48
          &mean_&Kvot_&man36   
          &mean_&Kvot_&man24  
          &mean_&Kvot_&man12  
          &mean_&Kvot_&man8 
          &mean_&Kvot_&man6 
          )*Number / overlay skipmiss legend=legend1 
                           vref=-10 
                           vref=0 
                           vref=10 
	 					  wvref=(1 3 1)
						  lvref=(2 1 2)
						   href=240
						   href=267
	 					 whref=(2 2)
                           haxis=axis1
                           vaxis=axis2
                           ; 

run;
quit;

ods pdf close;
ods listing;

160902 SAS_info.PNG160902 pdf_clip.PNG160902 emf_clip.PNG
1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Many of the older Graphics procedures based on devices do not always play well with ODS output as the ODS styles control some of the output appearance and the graphics statements such as SYMBOL don't always behave as expected.

 

I'm not sure what you are actually expecting for output but I would strongly suggest investigating the SG procedures as that is where SAS is spending appearnce improvement efforts.

 

The other might be to go find a SAS PDF graphics device and use that in the your GDEVICE settings for active device and target device.

Try running proc gdevice to see if you have any device like PDF PDFA or PDFC or ZPDF and ZPDFC available.

 

Also you may need to Close the HTML destination before creating the graph. Otherwise there's some things where ODS creates the HTML output which is a PNG and then basically sends that to convert to PDF (I think).

View solution in original post

3 REPLIES 3
ballardw
Super User

Many of the older Graphics procedures based on devices do not always play well with ODS output as the ODS styles control some of the output appearance and the graphics statements such as SYMBOL don't always behave as expected.

 

I'm not sure what you are actually expecting for output but I would strongly suggest investigating the SG procedures as that is where SAS is spending appearnce improvement efforts.

 

The other might be to go find a SAS PDF graphics device and use that in the your GDEVICE settings for active device and target device.

Try running proc gdevice to see if you have any device like PDF PDFA or PDFC or ZPDF and ZPDFC available.

 

Also you may need to Close the HTML destination before creating the graph. Otherwise there's some things where ODS creates the HTML output which is a PNG and then basically sends that to convert to PDF (I think).

BenKra
Calcite | Level 5

Many thanks for your quick reply! Learning new procedures (as the SG you suggested) is a considerable investment of time, so I tried with device=pdfa (instead of pdf) first, but the result was the same. Nor was there an option in the definition that I could identify as manipulating line width. So my conclusion was that graphic from proc gplot with line width > 1 is simply not supportet by the pdf output device.

However, on the list of GDEVICE I also found the TIFF-format (which is not on the menue of the "export as image" option in the SAS "File" menue) and I could use that device by adapting code from a SAS-example for pdf-output.

 

filename tiffout &outputfile; /* &outputfile is defined in the macro I use, any physical filename will do */
goptions reset=all device=tiff border gsfname=tiffout;

Finally, I got an output that has both, scaleable text and proper line-width in the graphic with no need to paste. Many thanks for setting me on the right track!

Benno

BenKra
Calcite | Level 5

Finally, it turned out that the whole question was a misunderstanding:

I thought line width is ignored when printing to pdf. What actually happens is that when resolution of a graphic is increased (such as switching from display to pdf), lines that join data points on a plot (i.e. lines that are not straight) appear smaller (i.e. less width). Increasing line width from, say, 1 to 5 pixels appears as no perceptible change. Therefore, I thought line width is ignored. Actually, more substantial increases in line width (to 35 or 50 pixels) are necessary for the line to appear with similar width as on plots with poor resolution (i.e. that have less dots per inch). Dots and other symbols do not behave that way (their height appears in similar proportion, regardless of the graphic resolution).

So, no format change is necessary to make lines on high-resolution plots appear with same width as on low-resolution, just a substantial increase in line width.

Benno

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 1784 views
  • 0 likes
  • 2 in conversation