BookmarkSubscribeRSS Feed
bendsteel6
Obsidian | Level 7

I must be just not seeing something.  I simply want a chart that has a VBAR for each of these attributes grouped by the 'entity':

EntityOSATDPLTRMLTPWADOTTIACOMMTTSERSAT
National0.820.710.690.50.880.820.810.780.87
CENTRAL0.830.740.720.480.890.830.820.80.88
Group0.810.690.660.440.880.790.770.780.86
Dealer10.880.760.730.370.890.810.80.810.9

 

The chart I would like it to look like is attached.  This should be very simple but I'm missing it.

 

Please help!

4 REPLIES 4
DanH_sas
SAS Super FREQ

You need to transpose your data so that you have just three variables: Level, Entity, and Value. For each Level (National, etc.), you should have all Entities and their corresponding Values. The resulting data set should be 36 observation long with three variables. Then, the following SGPLOT code should give you the chart you want:

 

proc sgplot data=mydataset;
xaxis display=(nolabel);
vbarparm category=level response=value / group=entity groupdisplay=cluster;
run;

Hope this helps!
Dan

bendsteel6
Obsidian | Level 7

Along with your response and "PROC Star's"  response, this works well.  Thanks!!!

SuryaKiran
Meteorite | Level 14

Transpose the data and then use SGPLOT.

data have;
infile datalines dsd dlm=',' missover;
input Entity :$10. OSAT DP	LTR	MLTP	WADO	TTIA	COMM	TTSE	RSAT;
datalines;
National,0.82,0.71,0.69,0.5,0.88,0.82,0.81,0.78,0.87
CENTRAL,0.83,0.74,0.72,0.48,0.89,0.83,0.82,0.8,0.88
Group,0.81,0.69,0.66,0.44,0.88,0.79,0.77,0.78,0.86
Dealer1,0.88,0.76,0.73,0.37,0.89,0.81,0.8,0.81,0.9
;
run;

proc transpose data=have out=have_t ;
by Entity notsorted;
run;

proc sgpanel data=have_t;
  panelby Entity / layout=columnlattice onepanel colheaderpos=bottom rows=1 novarname noborder;
vbar _name_  / group=_name_ response=Col1 stat=sum  nostatlabel; 
colaxis  display=none ;
label col1="" _name_="";
rowaxis grid;
keylegend / position=right;
run;
Thanks,
Suryakiran
bendsteel6
Obsidian | Level 7

This along with "SAS Super FREQ's" response, I was able to accomplish what I need, and to realize that yes, I do have to transpose the data.  I was hoping to be able to graph it without having to do that.  But this works!

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
  • 4 replies
  • 976 views
  • 4 likes
  • 3 in conversation