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

Hello, I wrote some proc templates to create some graphs and pies, but after outputting them for export to excel, they become extremely small. Even in excel it takes the size of 1 row and even smaller. What am I doing wrong?

Here is an example of my Macro to create a pie:

 

%macro Pie_S(Category, response, dataIn);

 

proc template;
define statgraph pie_S;
begingraph / datacolors=(&fillcolors_graphs_S) attrpriority=none;
layout region;
piechart category=&Category response=&response / outlineattrs=(pattern=2 color=lightgrey)
datalabellocation=outside
categorydirection=clockwise
start=90
name= 'pie';
endlayout;
endgraph;
end;
run;

proc sgrender data=&datain template=pie_S ;
run;

 

%mend Pie_S;

 

I export with ODS Excel (for confidentiality reasons I've put X's where needed):

 

ods excel file= "XXXX.xlsx";
ods excel options(sheet_name='XXX' embedded_titles='no');
%pie_s(gegevens,percentage,XXX);
ods excel options(sheet_name='XXX' embedded_titles='no');
%pie_s(gegevens,percentage,XXX);
ods excel options(sheet_name='XXX' embedded_titles='no');
%pie_s(gegevens,percentage,XXX);
ods excel close;

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
AScraeyen
Fluorite | Level 6

I found the mistake I made. In the overall code, I left a ods graphics with the wrong size (I mixed up inches, pts and cm, as I usually use the European standards). Removing the ods graphic and letting SAS choose the best format, solved the problem. 

View solution in original post

4 REPLIES 4
ballardw
Super User

What are your current settings for ODS GRAPHICS options?

 

You may need to specify some size units in Height and Width options such as

ODS GRAPHICS Height=5in Width=7in;

which would set the display to 5 inches by 7 inches Or the equivalent in the GTL  DESIGNWIDTH and DESIGNHEIGHT options of STATGRAPH in your template. The defaults are defined in pixels and with a high resolution screen pixels are pretty small.

AScraeyen
Fluorite | Level 6

Unfortunately, I tried already to fix the size, but that doesn't change this problem. I can make graphs one moment, and the next time I run my code, they become really really small... 

AScraeyen
Fluorite | Level 6

with 5in on 5in it gives the same result in sas (and the same size in excel):

AScraeyen_0-1647607427819.png

rather small and difficult to read /  analyse, no? 

AScraeyen
Fluorite | Level 6

I found the mistake I made. In the overall code, I left a ods graphics with the wrong size (I mixed up inches, pts and cm, as I usually use the European standards). Removing the ods graphic and letting SAS choose the best format, solved the problem. 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 4 replies
  • 1172 views
  • 0 likes
  • 2 in conversation