BookmarkSubscribeRSS Feed
Hari6
Calcite | Level 5

 

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. 

 

2 REPLIES 2
DanH_sas
SAS Super FREQ

What version of SAS are you using?

Hari6
Calcite | Level 5
SAS 9.4 Windows version and I need to save this in RTF file

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 940 views
  • 0 likes
  • 2 in conversation