Hello
I outputted results from proc tabulate and sgplot to a pdf file. I used ODS region to place the table and bar chart next to each other on one page. Everything looks good except for the label for ALL (tables (ALL='Total'...), instead of total, it's using a label for another variable? When I don't use ODS region, it resolves that issue. Not sure what I'm missing or if there is a better way to output the table and graph side by side that doesn't require ODS region? Any tips would be appreciated. Thanks!
%let todaysDate1 = %sysfunc(today(), DATE9.);
%put &todaysDate1;
options orientation=landscape nodate pageno=1 leftmargin=.25in rightmargin=.25in topmargin=.25in bottommargin=.25in;
ODS pdf file="C:\ODSRegionOutput..pdf" style=journal bookmarklist=none pdftoc=2;
ODS layout start columns=2;
ODS region;
proc tabulate data=dataset1;
class newage/missing preloadfmt mlf order=data s=[font_style=italic font_weight=bold CellWidth=200];
class newrace/missing preloadfmt mlf order=data s=[font_style=italic font_weight=bold ];
class Gender/missing mlf order=data s=[font_style=italic font_weight=bold ];
class resident/missing mlf order=data s=[font_style=italic font_weight=bold];
tables (ALL='Total' newage='Age' newrace='Race/Ethnicity' Gender='Sex' resident='Residence'),( N colpctn='(%)');
format newage age. newrace racegrp.;
run;
ODS graphics on/ width=5.5in height=4in noborder;
ODS region;
proc sgplot data=dataset1;
vbar date/ stat=sum datalabelfitpolicy=rotate datalabel;
xaxis label='Date' values = ('20DEC2020'd to "&todaysDate1"d by day) valueattrs=(size=7pt);
yaxis label='Number' ;
format date MMDDYYS.;
run;
ODS graphics off;
ODS layout end;
ODS pdf close;
We ca't replicate as you use date we don;t have access to, but from your description this looks like a bug.
You should contact SAS Tech Support.
Thank you. I contacted SAS support and indeed it is a bug. It has been reported. I used the columns= option and it worked.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.