SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
aewing
Calcite | Level 5

Hello,

 

I am trying to create a pdf with 2 elements on each sheet: 1 sgplot and 1 proc print (small table), however as a result I always get the text in the graph (axis labels and title) compressed on itself, which is ugly. 

I tried multiple things (resizing with ods graphic etc.) but really still don't know what I am doing wrong...

 

 

Thanks in advance for your help.

 

ods _all_ close;
ods escapechar = '^';
options orientation=landscape center pageno=1 nodate LEFTMARGIN=0.25in RIGHTMARGIN=0.25in TOPMARGIN=0.25in BOTTOMMARGIN=0.25in papersize=A4;
ods pdf file="whicheverpath/data.pdf" notoc startpage=never dpi=200;

ods pdf startpage=now;

proc odstext;
   title "testtitle";
run;

ods layout start columns=2;
ods region column=1;

proc sgplot data=TABLE ;
  series x=MONTH y=INDIC / lineattrs=(color=blue);
  xaxis type=discrete valueattrs=(size=7pt) grid;
  YAXIS DISPLAY=(NOLABEL) grid;
  title;
run;

ods region column=2;

PROC PRINT DATA=TABLE noobs; run;
ods layout end;

ODS PDF CLOSE;
1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
Have you tried explicitly setting the size of the graph/regions you want?
You can specify a width/height on the ODS REGION statement and control it in that manner.

View solution in original post

5 REPLIES 5
RichardDeVen
Barite | Level 11

Can you add an image showing the compressed (squished or squashed) text ?

 

For instance, your code, run against SASHELP.AIR, does not exhibit any funky text renderings.

 

ods _all_ close;
ods escapechar = '^';
options orientation=landscape center pageno=1 nodate LEFTMARGIN=0.25in RIGHTMARGIN=0.25in TOPMARGIN=0.25in BOTTOMMARGIN=0.25in papersize=A4;
ods pdf file="2each.pdf" notoc startpage=never dpi=200;

ods pdf startpage=now;

proc odstext;
   title "testtitle";
run;

ods layout start columns=2;
ods region column=1;

proc sgplot data=sashelp.air ;
  series x=date y=air / lineattrs=(color=blue);
  xaxis type=discrete valueattrs=(size=7pt) grid;
  YAXIS DISPLAY=(NOLABEL) grid;
  title;
  where year(date)=1951;
run;

ods region column=2;

PROC PRINT DATA=sashelp.air noobs; 
  where year(date)=1951;
run;
ods layout end;

ODS PDF CLOSE;
aewing
Calcite | Level 5

Hi,

 

Thanks for your answer.

Even if in SAS itself the graph is shown with the right size, it is squished in the final PDF output, as you can see:

 

Example.PNG

Reeza
Super User
Have you tried explicitly setting the size of the graph/regions you want?
You can specify a width/height on the ODS REGION statement and control it in that manner.
aewing
Calcite | Level 5

Hi,

 

your solution worked, however I had to couple it with something else, formatting the pictures into gifs:

 

ods graphics on / width=17cm height=13cm outputfmt=gif;
...
ods layout start columns=2;
ods region column=1 width=17cm height=13cm;

As a result my PDF is a lot bigger in size (maybe I can try other formats and see how it goes), but at least the proportions are now correct.

 

Thanks again for your help!

 

 

Reeza
Super User
I usually recommend SVG or PNG as image types for best quality. Not all format types work in all destinations though.

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 2046 views
  • 0 likes
  • 3 in conversation