Data visualization with SAS programming

sgpanel vbar graph with tabular data

Reply
Frequent Contributor
Posts: 99

sgpanel vbar graph with tabular data

Hi all,
I want to create a sgpanel vbar graph by region, where the sas dataset is in following format. I dont know how to assign the response in the vbar.

Region qtr1 qtr2 qtr3 qtr4 <-- variable names
East 20 10 30 40
West 10 40 30 10
North 50 20 60 30
South 30 10 20 60

Thanks for all your help.

Regards,

Amit
SAS Super FREQ
Posts: 864

Re: sgpanel vbar graph with tabular data

You just need to transpose your data. Here's a simple example using your posted data:

data test;
input region $ qtr1 qtr2 qtr3 qtr4;
cards;
East 20 10 30 40
West 10 40 30 10
North 50 20 60 30
South 30 10 20 60
;
run;

proc transpose data=test out=transposed;
by region notsorted;
var qtr1 qtr2 qtr3 qtr4;
run;

proc sgpanel data=transposed;
panelby region;
vbar _name_ / response=col1;
run;
Frequent Contributor
Posts: 99

Re: sgpanel vbar graph with tabular data

Hi Dan,
Thanks for the solution. Its works great.

I appreciate all your help.

Regards,

Amit
Post a Question
Discussion Stats
  • 2 replies
  • 85 views
  • 0 likes
  • 2 in conversation