- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm wondering when the name= option of the xaxistable/yaxistable could be used.
I've created an example where name='test' is not referenced anywhere.
proc sql;
create table class as
select sex, mean(height) as mean_height
from sashelp.class
group by sex;
run;
proc sgplot data=class ;
vbarbasic sex / response=mean_height;
xaxistable mean_height / name='test';
legenditem type=text name='A' / text='xx'
label='Demo';
keylegend 'A' / position=right;
run;
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@xxformat_com wrote:
When I added 'text' in keylegend nothing was displayed. Therefore I was wondering if it was recognized and what text would then be displayed in the legend.
Legends would not be created in a graph with with a single Plot statement (i.e. Vbarbasic) with no overlay or group variable. XAXISTABLE by itself doesn't create a legend as it is not a plot statement.
Contrived and not a suggested graph but demonstrates name= with multiple XAXISTABLE statements:
proc sgplot data=sashelp.class ; vbar sex / response=height stat=mean group=age name='bar'; xaxistable height / colorgroup=age name='test'; xaxistable weight / colorgroup=sex name='test2'; keylegend 'test' / position=bottom title='Mean Height'; keylegend 'test2'/ position=right title='Weights'; run;
Note the different colorgroup variable, what that does to the row variables.
Default behavior is going to reuse colors which is why this isn't a very good graph but you were asking about Name= and shows that you can get different somewhat different legends for different XAXISTABLEs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Pretty much the same reasons as having the Name= option for any of the plots: control of keylegend output.
Remember that you can have multiple XAXISTABLE statements in a single plot. If you want to create a Keylegend output you have to be able to tell keylegend which one to use.
Also, you may want to use multiple Keylegend statements to create multiple legends and again need names to control which legend options go with which item.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@xxformat_com wrote:
When I added 'text' in keylegend nothing was displayed. Therefore I was wondering if it was recognized and what text would then be displayed in the legend.
Legends would not be created in a graph with with a single Plot statement (i.e. Vbarbasic) with no overlay or group variable. XAXISTABLE by itself doesn't create a legend as it is not a plot statement.
Contrived and not a suggested graph but demonstrates name= with multiple XAXISTABLE statements:
proc sgplot data=sashelp.class ; vbar sex / response=height stat=mean group=age name='bar'; xaxistable height / colorgroup=age name='test'; xaxistable weight / colorgroup=sex name='test2'; keylegend 'test' / position=bottom title='Mean Height'; keylegend 'test2'/ position=right title='Weights'; run;
Note the different colorgroup variable, what that does to the row variables.
Default behavior is going to reuse colors which is why this isn't a very good graph but you were asking about Name= and shows that you can get different somewhat different legends for different XAXISTABLEs.