sas >> proc gplot legend question

by sassql » Tue, 11 Sep 2007 02:27:41 GMT

Dear all,

I am trying to display the number of subjects in each treatment at the
top right side corner of my plot using the following code. The macro
variable &aa and &bb has the count of patients in it.

legend1 label = none
position = (top right inside)
offset = (0.5)
across = 1
shape = symbol(1,1)
mode = share
value = (h =1 t= 1 "&a.(N=&aa)" j = left t = 2 "&b.(N=&bb)" j = left);

However the legend when the plot gets produced, displays something
like this:

nameoftreatment (N= 100 ). It leaves a space after 100 and i want to
suppress that. Can someone tell me how can i do that?

Also how can we reduce the height of the values displayed on the x and
y axis.

Thanks in advance

Regards,



sas >> proc gplot legend question

by sassql » Tue, 11 Sep 2007 02:31:54 GMT


Dear all,

I am trying to display the number of subjects in each treatment at the
top right side corner of my plot using the following code. The macro
variable &aa and &bb has the count of patients in it.

legend1 label = none
position = (top right inside)
offset = (0.5)
across = 1
shape = symbol(1,1)
mode = share
value = (h =1 t= 1 "&a.(N=&aa)" j = left t = 2 "&b.(N=&bb)" j = left);

However the legend when the plot gets produced, displays something
like this:

nameoftreatment (N= 100 ). It leaves a space after 100 and i want to
suppress that. Can someone tell me how can i do that?

Also how can we reduce the height of the values displayed on the x and
y axis.

Thanks in advance

Regards,




sas >> proc gplot legend question

by jonathan.harris8 » Tue, 11 Sep 2007 04:04:30 GMT

I'm sure there's a better way to do this, but I handle such situations
by creating a macro variable that includes the n= and the ( ). For
example:

ods output onewayfreqs=n;
proc freq data=one;
table study;
run;

data _null_;
set n;
npre="(n="||compress(put(frequency,2.))||")";
call symput ("npre",npre);
run;



proc gplot legend question

by ya.huang » Tue, 11 Sep 2007 04:23:09 GMT

Use macro function %cmpres():

value = (h =1 t= 1 "&a.(N=%cmpres(&aa))" j = left t = 2 "&b.(N=%cmpres
(&bb))" j = left);





proc gplot legend question

by sassql » Tue, 11 Sep 2007 20:27:48 GMT





Dear all,

Thanks a lot for your suggestion and spending time after this.
Appreciate it. That work's fine. however there is a warning that it
keeps giving me "Specified placement options have caused legend to
extend beyond normal boundaries. This are my legend specifications:

legend1 label = none
position = (top right inside)
offset = (0.1)
across = 1
shape = symbol(1,1)
mode = share
value = (h =1 t= 1 "&a.(N=%cmpres(&aa))" j = left t = 2 "&b.(N=
%cmpres(&bb))" j = left);

This is the warning from the log:

WARNING: Specified placement options have caused legend to extend
beyond normal boundaries.
NOTE: At least one pointlabel has overwritten a boundary. This
resulted in the affected
pointlabel(s) being repositioned.

Can you please help me this and how to remove this warning from the
log?

Regards,





proc gplot legend question

by ya.huang » Tue, 11 Sep 2007 23:35:52 GMT

Check out the following which address this issue:

http://support.sas.com/techsup/unotes/V6/4/4955.html







proc gplot legend question

by Ya.Huang » Wed, 12 Sep 2007 00:44:16 GMT

k, I've followed tech support note and changed both hpos and shape
parameters,
but none of them seems to work. The only way I found to get rid of the
message
is to change the position to "(top left outside)" or "(top center
outside)", instead of
"(top right outside)":

%let a=xxxxxx xxxxxx;
%let aa= 56 ;
%let b=yyyyyy yyyyyyy;
%let bb= 66 ;

goptions reset=all /* hpos=200 */;
legend1 label = none
position = (top right inside) /* this works (top left inside) */
offset = (0.5)
across = 1
shape = symbol(1,1) /*(5,1)*/
mode= share
value = (h =1 t= 1 "&a.(N=%cmpres(&aa))" j = right t = 2
"&b.(N=%cmpres(&bb))" j = right);

proc gplot data=sashelp.class;
plot weight*age=sex / legend=legend1;
run;

________________________________

From: mike patel [mailto: XXXX@XXXXX.COM ]
Sent: Tuesday, September 11, 2007 9:15 AM
To: Huang, Ya
Subject: Re: proc gplot legend question


Dear Ya,

Thanks for the suggestion. But can you suggest me how do i reduce the
size of the values on x and y axis?

Regards,


On 9/11/07, Ya Huang < XXXX@XXXXX.COM > wrote:

Check out the following which address this issue:

http://support.sas.com/techsup/unotes/V6/4/4955.html

On Tue, 11 Sep 2007 05:27:48 -0700, XXXX@XXXXX.COM wrote:

>On Sep 10, 4:23 pm, XXXX@XXXXX.COM (Ya Huang) wrote:
>> Use macro function %cmpres():
>>
>> value = (h =1 t= 1 "&a.(N=%cmpres(&aa))" j = left t = 2
"&b.(N=%cmpres
>> (&bb))" j = left);
>>
>>
>>
>> On Mon, 10 Sep 2007 11:27:41 -0700, XXXX@XXXXX.COM wrote:
>> >Dear all,
>>
>> >I am trying to display the number of subjects in each
treatment at the
>> >top right side corner of my plot using the following code.
The macro
>> >variable &aa and &bb has the count of patients in it.
>>
>> >legend1 label = none
>> >position = (top right inside)
>> >offset = (0.5)
>> >across = 1
>> >shape = symbol(1,1)
>> >mode = share
>> >value = (h =1 t= 1 "&a.(N=&aa)" j = left t = 2 "&b.(N=&bb)"
j = left);
>>
>> >However the legend when the plot gets produced, displays
something
>> >like this:
>>
>> >nameoftreatment (N= 100 ). It leaves a space after 100 and i
want to
>> >suppress that. Can someone tell me how can i do that?
>>
>> >Also how can we reduce the height of the values displayed on
the x and
>> >y axis.
>>
>> >Thanks in advance
>>
>> >Regards,- Hide quoted text -
>>
>> - Show quoted text -
>
>Dear all,
>
>Thanks a lot for your suggestion and spending time after this.
>Appreciate it. That work's fine. however there is a warning
that it
>keeps giving me "Specified placement options have caused legend
to
>extend beyond normal boundaries. This are my legend
specifications:
>
>legend1 label = none


Similar Threads

1. Proc gplot / legend question

Hi SASor,
  Suppose I run the following code:
  symbol1 .....;
  symbol2 .....;
  symbol3 .....;
  symbol4 .....;
  symbol5 .....;
  proc gplot data=a;
   plot var1*var2/ id;
  run;
quit;
  If the id contents 1,2,3,4 and 5; after I ran the code I will get the graph with legend for the 5 ids with difference symbols by order 1,2,3,4 and 5 sequentially.
  What I want is to re-order the legend sequence by 4,2,3,1 and 5.
  Is there a way to customize the legend sequence?
   Thanks,
  ss df



---------------------------------
Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.

2. Proc GPLOT - Legend Question

3. SUSPECT: SUSPECT: Proc GPLOT - Legend Question

On Wed, 1 Apr 2009 13:03:48 -0400, Siddharth Jain < XXXX@XXXXX.COM >
wrote:

>I am sorry I was not able to explain you.
>
>Variable Censor has values 0 and 1. Irrespective of that, I want to
>display 5 numbers in my legend (which are not in the dataset).

At this point, providing an example of the intended legend and details
about the numbers (are they constants, where are they held) will help.

Have you considered a FOOTNOTE statement?  You could do away with the
FRAME around the legend or even the legend itself and use an ANNOTATE
dataset.

Kevin

4. SUSPECT: SUSPECT: Proc GPLOT - Legend Question

5. GPLOT legend and device questions (repost)

Original post 9/6/2005 did not propagate.
Using the Graph-N-Go, on 9.1.3 for WIN2000, generated code below I have
the following questions.
1 - The code did not build the legend statement.  How do I build the
legend
so that all 3 vars (trn_nbr, cbk_nbr, vdn_nbr) are in a boxed legend
centered outside the right of the graph and each tick is on a seperate
line?
2 - The scale for the axis1 is defaulting to 10, how do I display all
values?
3 - How do I scale axis2 and axis3 to 5?
4 - Likely a new topic.  When I specify the java or gif device, I
frequently get a *dll windows error message.  Is this a symptom which
may require me to reload Sas 9.1.2.3 or updated device drivers?
/* BEGIN CODE */
/* Graph-N-Go SAS/Graph Code comments removed */
data temp;
  attrib Day length=8  format=Z2.;
  attrib TRN_NBR length=8 label="Messages" ;
  attrib CBK_NBR length=8 label="Call Backs" ;
  attrib VDN_NBR length=8 label="ACD Calls" ;
  input  Day= TRN_NBR= CBK_NBR= VDN_NBR=;
  datalines;
 Day=1 TRN_NBR=35 CBK_NBR=0 VDN_NBR=13
 Day=2 TRN_NBR=27 CBK_NBR=0 VDN_NBR=10
 Day=3 TRN_NBR=19 CBK_NBR=0 VDN_NBR=10
 Day=4 TRN_NBR=45 CBK_NBR=4 VDN_NBR=17
 Day=5 TRN_NBR=16 CBK_NBR=0 VDN_NBR=10
 Day=8 TRN_NBR=45 CBK_NBR=1 VDN_NBR=16
 Day=9 TRN_NBR=26 CBK_NBR=9 VDN_NBR=7
 Day=10 TRN_NBR=12 CBK_NBR=3 VDN_NBR=3
 Day=11 TRN_NBR=18 CBK_NBR=2 VDN_NBR=4
 Day=12 TRN_NBR=37 CBK_NBR=1 VDN_NBR=11
 Day=15 TRN_NBR=39 CBK_NBR=4 VDN_NBR=6
 Day=16 TRN_NBR=30 CBK_NBR=3 VDN_NBR=12
 Day=17 TRN_NBR=27 CBK_NBR=3 VDN_NBR=11
 Day=18 TRN_NBR=31 CBK_NBR=1 VDN_NBR=7
 Day=19 TRN_NBR=33 CBK_NBR=0 VDN_NBR=11
 Day=22 TRN_NBR=32 CBK_NBR=0 VDN_NBR=15
 Day=23 TRN_NBR=31 CBK_NBR=2 VDN_NBR=17
 Day=24 TRN_NBR=43 CBK_NBR=0 VDN_NBR=17
 Day=25 TRN_NBR=24 CBK_NBR=8 VDN_NBR=14
 Day=26 TRN_NBR=30 CBK_NBR=0 VDN_NBR=12
 Day=29 TRN_NBR=30 CBK_NBR=1 VDN_NBR=10
 Day=30 TRN_NBR=32 CBK_NBR=3 VDN_NBR=15
 Day=31 TRN_NBR=36 CBK_NBR=8 VDN_NBR=12
;
run;
%let path = %sysfunc(pathname(work))\;
/* Begin ODS output */
ods listing close;
ods html file="&path.Sample.htm" (title="Graph-N-Go Output")
           gpath="&path" gtitle gfootnote style=minimal;
/* Set the SAS/Graph options */
goptions reset=all border nodash
         ctext=CX000000 ftext="MS Sans Serif" htext=8 pt
         colors=(CX0000FF CXFF0000 CX008080 CX00FF00
                 CXFF00FF CXFFFF00 CX00FFFF CX800000
                 CX008000 CX800080 CX000080 CX808000
                 CXFFFFFF CX808080 CXC0C0C0 CX000000);
/* Set the SAS/Graph device driver */
* goptions device=JAVA xpixels=761 ypixels=489;

/* AXIS1 describes the X-axis (horizontal)      */
axis1 minor=none label=("Day") color=CX000000 offset=(5pct,5pct) ;

/* AXIS2 describes the left Y-axis (vertical)   */
axis2 minor=none label=none color=CX000000 offset=(5pct,5pct);

/* AXIS3 describes the right Y-axis (vertical)   */
axis3 minor=none label=none color=CX000000 offset=(5pct,5pct);

/* Each SYMBOL statement specifies style, size and */
/* color for markers and join lines for an overlay */
symbol1 line=1  width=1 cv=CX0000FF ci=CX0000FF value=Dot interpol=Join
height=6 pt;
symbol2 line=33 width=1 cv=CX008080 ci=CX008080 value=Triangle
interpol=Join height=6 pt;
symbol3 line=20 width=1 cv=CXFF0000 ci=CXFF0000 value=Square
interpol=Join
height=6 pt;

proc gplot data=temp;
   plot TRN_NBR*DAY=1 / nolegend
      haxis=axis1 vaxis=axis2
      cframe=CXFFFFFF caxis=CX000000;
   plot2 VDN_NBR*DAY=2 CBK_NBR*DAY=3 / overlay legend=legend1
vaxis=axis3;
run;
quit;
/* Reset all graphics options */
goptions reset=all;
/* End ODS output */
ods html close;
ods listing;
/* END CODE */

6. GPLOT legend and device questions

7. gplot legend device type special characters question

Hi all,
i am trying to put the special characters alpha and beta in the legend of
my equation.....but it is coming as a blank and the sas log states that

NOTE: A hardware font was specified that is not available on the device
WIN. If the font is available on the hardcopy device, it will be utilized
      if/when the previewed graph is printed.

i am using windows sas 8.2......
could someone point me in the right way....have copied my whole gplot code
below...
thanks
hari.....

******special characters for equation;
data _null_ ;
 s1 = byte(222) ;
 s2 = byte(223) ;
    call symput('alpa',s1);
    call symput('beta',s2);
put s1=  s2= ;
run ;


goptions reset=global gunit=pct border cback=white
         ftitle=swissb ftext=swiss htitle=4 htext=2 gsfmode=replace ;

symbol1 c=black v=dot w=4 I=none L=4 height=2;

symbol2 c=black w=4 i=r height=2;

axis1 order=(0 to 0.006 by 0.0015) offset=(2,2)
      label=("xxx")
      major=(height=3) minor=none
      width=3;

axis2 order=(2 to 6.5 by 0.5) offset=(0,0)
      label=("yyy")
      major=(height=2) minor=none
      width=3;

legend1 label=(H=0.15 in "Ln y = &alpa. + &beta.*ln(x)" POSITION=(bottom
right))
        position=(bottom right inside)
 offset=(1 , 5)
        mode=share;

%inc gtitles;

proc gplot data=stat gout= &mrlstref ;
   plot y*x y1*x / overlay
                             haxis=axis1 hminor=4 legend=legend1
                             vaxis=axis2 vminor=1 noframe;
run;
quit;

8. SAS/GRAPH: legend on PROC GPLOT truncates label