The SAS Output Delivery System and reporting techniques

SGPLOT & multiple lines per X-axis legend

Reply
Regular Contributor
Regular Contributor
Posts: 170

SGPLOT & multiple lines per X-axis legend

Hello all;
I am wondering if there is a "simple" way to "split" a legend marker so that:
Jan07/MD=x/RN=x
becomes

Jan07
MD=x
RN=x

I see the split function is available for other SAS graphing capabilities, just not SGPLOT.

I have been poking around all the documentation for SGPLOT and Xaxis and not find much except for the graphics template language, which I am not ready to dive into just yet.


Much thanks!

Lawrence
SAS Super FREQ
Posts: 896

Re: SGPLOT & multiple lines per X-axis legend

Currently, there is not a way to create the SPLITCHAR functionality using the SG procedures. There is a technique you can use in GTL to create this effect. Let me know if you are interested.
Regular Contributor
Regular Contributor
Posts: 170

Re: SGPLOT & multiple lines per X-axis legend

Dan;
Rats! Would be interested in knowing more about GTL.
I have seen a couple of examples online so I will look there too.
Thanks.

Lawrence
SAS Super FREQ
Posts: 896

Re: SGPLOT & multiple lines per X-axis legend

Here is a GTL example from a colleague that demonstrates how to create a "splitchar" axis. The keys here are splitting the text in the datastep, turning off the axis tick values, and using a blockplot to render the text.

proc template;
define statgraph tickvaluewrap;
begingraph ;
layout lattice / column=1 rowgutter=0 rowweights=(.85 .15)
columndatarange=union;
columnaxes;
columnaxis / offsetmin=.11 offsetmax=.11 display=none;
endcolumaxes;
barchart x=question y=answer / ;
blockplot x=question block=line / class=n display=(values) valuehalign=center;
endlayout;
endgraph;
end;
run;

data survey;
length line $20;
input Answer Question $3-70;
n=1;
line= scan(question,n,"~");
do while( lengthn(line) > 0 );
output;
n+1; answer=.;
line= scan(question,n,"~");
end;
datalines;
3 #1~How do you~feel today?
4 #2~Would you be~willing to try this~again?
2 #3~Is there some~way to get there~from here?
5 #4~When do you~think this will~be finished,~today?
run;

proc sgrender data=survey template=tickvaluewrap;
run;
Regular Contributor
Regular Contributor
Posts: 170

Re: SGPLOT & multiple lines per X-axis legend

Dan;
I'll take a look. Thanks for sharing this.
~Lawrence
Ask a Question
Discussion stats
  • 4 replies
  • 373 views
  • 0 likes
  • 2 in conversation