Data visualization with SAS programming

Data table beneath the graph

Reply
New Contributor
Posts: 2

Data table beneath the graph

 

options formchar=",";

proc template;
	define statgraph barblock;
		begingraph;
			entrytitle 'Total Sales Across Regions';
			layout lattice / rowweights=(.60 0.05 .35) ;
				layout overlay;
					barchart x=region y=sales / group=region barlabel=true dataskin=gloss;
				endlayout;
				layout overlay / xaxisopts=(type=discrete label='Number of Stores per Region' 
					display=(label)) walldisplay=none;
					entry halign=left '                                 Median                              col1                                   col2                         col3                                 col4';
				endlayout;
				blockplot x=region block=shoes_ / class=product display=(outline values label fill) 
					repeatedvalues=true DATATRANSPARENCY=0 display=all /*EXTENDBLOCKONMISSING=FALSE*/
				valuevalign=bottom
				VALUEFITPOLICY=truncate VALUESPLITCHAR=" ," VALUESPLITCHARDROP=TRUE valueattrs=(size=7pt)
				valuehalign=left repeatedvalues=true labelattrs=(size=8pt);
				;
			endlayout;
		endgraph;
	end;
run;

proc sort data=sashelp.shoes out=new;
	by region product;
run;

proc means data=new noprint;
	where region in('Africa' 'Asia' 'Canada' 'Pacific' 'United States');
	id sales;
	by region product;
	var stores;
	output out=shoes_ sum=;
run;

data shoes;
 	set shoes_;
	by region product;
	shoes_=compress(put(stores,4.)||" ,"||strip(put(stores,4.)));
run;

proc sgrender data=shoes template=barblock;
run;

image.png

 

Hi There,

 

The above shown is the sample data.

 

I want to display a data table under the below a SAS Graph and after searching few sites i got above sample code.

 

However my requirement is:

 

1) I need to display a DATA table which has 10 variable and 20 observations along with the graph.

2) For the table that i need to display in the graph i need to display Variable names as well.

3) I have each observation concatenated with  ",' (comma) inside the data set and this i did because i can not able to accommodate the lengthy data inside the graph. Hence i have concatenated separated by comma to split data by using 

(VALUEFITPOLICY=truncate VALUESPLITCHAR=" ," VALUESPLITCHARDROP=TRUE).

The splitting is not happened inside the graph data.

 

Could you help me to split the data inside the data table that being displayed in the graph and also suggest me how to accommodate more variables and observation inside the graph. 

 

SAS Super FREQ
Posts: 1,044

Re: Data table beneath the graph

What version of SAS are you using?

New Contributor
Posts: 2

Re: Data table beneath the graph

SAS 9.4 Windows version and I need to save this in RTF file
Ask a Question
Discussion stats
  • 2 replies
  • 178 views
  • 0 likes
  • 2 in conversation