BookmarkSubscribeRSS Feed
AmitKB
Fluorite | Level 6
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
2 REPLIES 2
DanH_sas
SAS Super FREQ
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;
AmitKB
Fluorite | Level 6
Hi Dan,
Thanks for the solution. Its works great.

I appreciate all your help.

Regards,

Amit

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