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