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;
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.
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.
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...
with 5in on 5in it gives the same result in sas (and the same size in excel):
rather small and difficult to read / analyse, no?
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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.