🔒 This topic is solved and locked.
Need further help from the community? Please
sign in and ask a new question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 08-17-2017 09:02 AM
(11413 views)
proc sgplot data=pande_app4_w_bad;
vbar Selskapspolicy / response=Bad_6m stat=mean DATALABEL
barwidth=0.6 fillattrs=graphdata1 ;
yaxis grid display=(nolabel);
xaxis display=(nolabel);
vbar Selskapspolicy / response=Bad_12m stat=mean DATALABEL
barwidth=0.4 fillattrs=graphdata2 ;
yaxis grid display=(nolabel);
xaxis display=(nolabel);
run;
I am not getting this as neat as I want to side by side...Anyone?
1 ACCEPTED SOLUTION
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If you want the blue and red bars to be placed side by side, you have two options.
- Use DISCRETEOFFSET. Reduce both bar widths, and use discreteoffset=-0.2 with one and discreteoffset=+0.2 with other. You can adjust the widths and offsets to suit.
- Change your data set from 2 response columns to one response column with a classifier. Then you can use the GROUP option with GROUPDISPLAY=CLUSTER to get side by side bars. This way is more scalable and preferable.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If you want the blue and red bars to be placed side by side, you have two options.
- Use DISCRETEOFFSET. Reduce both bar widths, and use discreteoffset=-0.2 with one and discreteoffset=+0.2 with other. You can adjust the widths and offsets to suit.
- Change your data set from 2 response columns to one response column with a classifier. Then you can use the GROUP option with GROUPDISPLAY=CLUSTER to get side by side bars. This way is more scalable and preferable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Yeah I want to use the Group option, but found it hard to implement as my data is of the type
reponsecolumn1 | responsecolumn2 |
1 | 1 |
0 | 1 |
0 | 0 |
1 | 0 |
How do I get it to a one response column and a classifier?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You can use PROC TRANSPOSE. if you have data set "Response" with Cat, Response1 and Response2, you can use the following. The response column names will show up as group values.
proc transpose data=response out=groups;
by cat;
run;
For a simple case like yours, I use a simple data step:
data groups;
keep Cat Group Response;
set response;
Group=1; Response=response1; output;
Group=2; Response=response2; output;
run;
Here is an article by Rick on this topic.