sas >> Proc gplot / legend question

by tggsun » Wed, 21 Mar 2007 08:53:19 GMT

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.


sas >> Proc gplot / legend question

by David.Johnson » Wed, 21 Mar 2007 08:59:08 GMT


The LEGEND statement permits the following option you'll find in the
online docs.

<Quote>

ORDER=(value-list)
selects or orders the legend values that appear in the legend. The way
you specify value-list depends on the type of variable that generates
the legend:

</Quote>

Kind regards

David



The Moving Finger writes; and, having writ,
Moves on: nor all your Piety nor Wit
Shall lure it back to cancel half a Line,
Nor all your Tears wash out a Word of it

Omar Khayyam (trans: Edward Fitzgerald)

-----Original Message-----
From: SAS(r) Discussion [mailto: XXXX@XXXXX.COM ] On Behalf Of df
ss
Sent: Wednesday, 21 March 2007 11:53 AM
To: XXXX@XXXXX.COM
Subject: 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.

************** IMPORTANT MESSAGE *****************************
This e-mail message is intended only for the addressee(s) and contains information which may be
confidential.
If you are not the intended recipient please advise the sender by return email, do not use or
disclose the contents, and delete the message and any attachments from your system. Unless
specifically indicated, this email does not constitute formal advice or commitment by the sender
or the Commonwealth Bank of Australia (ABN 48 123 123 124) or its subsidiaries.
We can be contacted through our web site: commbank.com.au.
If you no longer wish to receive commercial electronic messages from us, please reply to this
e-mail by typing Unsubscribe in the subject line.
**************************************************************



sas >> Proc gplot / legend question

by gerhard.hellriegel » Wed, 21 Mar 2007 18:41:48 GMT

a sample:

data a;
x=1; y=9; id=1; output;
x=2; y=2; id=2; output;
x=3; y=9; id=3; output;
x=4; y=6; id=4; output;
x=5; y=3; id=5; output;
x=6; y=2; id=1; output;
x=7; y=3; id=2; output;
x=8; y=5; id=3; output;
x=9; y=7; id=4; output;
x=10; y=1; id=5; output;
x=11; y=3; id=1; output;
x=12; y=1; id=2; output;
x=13; y=5; id=3; output;
x=14; y=4; id=4; output;
x=15; y=2; id=5; output;
x=16; y=7; id=1; output;
x=17; y=9; id=2; output;
x=18; y=1; id=3; output;
x=19; y=2; id=4; output;
x=20; y=8; id=5; output;
run;



symbol1 i=join c=red v=dot w=3 h=3;
symbol2 i=join c=blue v=dot w=3 h=3;
symbol3 i=join c=green v=dot w=3 h=3;
symbol4 i=join c=yellow v=dot w=3 h=3;
symbol5 i=join c=black v=dot w=3 h=3;


legend1 order=(4,2,3,1,5);


proc gplot ;
plot y*x=id / legend=legend1;
run;
quit;








graph with legend for the 5 ids with difference symbols by order 1,2,3,4
and 5 sequentially.
Games.


Proc gplot / legend question

by tggsun » Thu, 22 Mar 2007 02:29:12 GMT

Gerhard's code is helpful. If id is character, how should I modify the code?
Thans,
ss df


a sample:

data a;
x=1; y=9; id=1; output;
x=2; y=2; id=2; output;
x=3; y=9; id=3; output;
x=4; y=6; id=4; output;
x=5; y=3; id=5; output;
x=6; y=2; id=1; output;
x=7; y=3; id=2; output;
x=8; y=5; id=3; output;
x=9; y=7; id=4; output;
x=10; y=1; id=5; output;
x=11; y=3; id=1; output;
x=12; y=1; id=2; output;
x=13; y=5; id=3; output;
x=14; y=4; id=4; output;
x=15; y=2; id=5; output;
x=16; y=7; id=1; output;
x=17; y=9; id=2; output;
x=18; y=1; id=3; output;
x=19; y=2; id=4; output;
x=20; y=8; id=5; output;
run;



symbol1 i=join c=red v=dot w=3 h=3;
symbol2 i=join c=blue v=dot w=3 h=3;
symbol3 i=join c=green v=dot w=3 h=3;
symbol4 i=join c=yellow v=dot w=3 h=3;
symbol5 i=join c=black v=dot w=3 h=3;


legend1 order=(4,2,3,1,5);


proc gplot ;
plot y*x=id / legend=legend1;
run;
quit;








graph with legend for the 5 ids with difference symbols by order 1,2,3,4
and 5 sequentially.
Games.



---------------------------------
Don't be flakey. Get Yahoo! Mail for Mobile and
always stay connected to friends.


Proc gplot / legend question

by ya.huang » Thu, 22 Mar 2007 04:57:23 GMT

Do the same thing, except that no comma in between each quoted character
id value:

legend1 order=('4' '2' '3' '1' '5');




code?




Similar Threads

1. proc gplot legend question

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,

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