BookmarkSubscribeRSS Feed
eramirez
Fluorite | Level 6

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; 
2 REPLIES 2
ChrisNZ
Tourmaline | Level 20

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.

eramirez
Fluorite | Level 6

Thank you.  I contacted SAS support and indeed it is a bug.  It has been reported.  I used the columns=  option and it worked. 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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