I am using the code shown below to export a graph to excel. The graph in the Results Viewer- SAS tab shows the legend with the list of names of the colleges with the top 10 counts under the graph, but the graph in excel does not show the legend with the list of names of the colleges with the top 10 counts.
OPTIONS ORIENTATION=LANDSCAPE NODATE TOPMARGIN=".5IN" BOTTOMMARGIN=".5IN" LEFTMARGIN=".5IN" RIGHTMARGIN=".5IN" pageno=1;
ods excel file="&FILE_PATH.\Transfer_Top10_fa_&YEAR_START._&YEAR_END._&SYSDATE..xlsx";
ods excel options(sheet_name="Graph Top 10 counts");
proc sgplot data=GRAPH_DATA_TOP10 description="Top 10 counts of Transfer Students";
styleattrs backcolor=white wallcolor=cxC0C0C0;
series x = TERM_COHORT y = COUNT_PER_INST / group=INST_NAME_COHORT datalabel MARKERS MARKERATTRS=(SIZE=9.5 symbol=CircleFilled)
lineattrs = (thickness = 2 pattern=solid) NOMISSINGGROUP;
title "Top 10 counts of Transfer Students";
xaxis label = 'Fall Semesters';
yaxis label = ' ' grid;
keylegend / noborder;
run;
ods excel close;
ODS CLOSE _ALL_;
I found that my chart size was set too small since there were so many groups. I used this code to increase the size and the problem is solved. ods graphics / maxlegendarea=40;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.