Arzozeus
Arzozeus

Reputation: 103

How to generate 2 line in gplot graph

After I read the code from http://support.sas.com/kb/46/723.html, I want to create 2 line which having different category, below is my data :
x y Category
7 7 1
4 6 1
1 5 1
6 4 2
3.5 3 2
0.5 1 2

But I am not able to create two line with different category, below is my code

    /* Set the graphics environment */                                                                                                      
    goptions reset=all border cback=white htitle=12pt htext=10pt;                                                                           

    /* Define a title for the graph */                                                                                                      
    title1 "Include Only Select Values in the Legend";                                                                                      

    /* Define symbol characteristics */                                                                                                     
    symbol1 interpol=spline value=dot color=vibg;                                                                                           
    symbol2 interpol=spline value=dot color=depk;                                                                                           
    symbol3 interpol=spline value=dot color=mob;                                                                                            

    /* Define legend characteristics */                                                                                                     
    *legend1 order=('First' 'Third') label=none frame;                                                                                       

    /* Define axis characteristics */                                                                                                       
    axis1 label=none;                                                                                                                       

    proc gplot DATA=WORK.TEST_DATA(KEEP=x y Category);
        BY Category;                                                                                                                  
       plot (y y) * x / overlay legend=legend1 vaxis=axis1
    FRAME;
        BY Category;
    run;                                                                                                                                    
    quit;

My expected result should have 2 line with different category in one graph, how should my code write? Please help, thank you.

Upvotes: 0

Views: 138

Answers (1)

user667489
user667489

Reputation: 9569

Try something like this:

proc sort data = sashelp.class out = class;
  by SEX AGE;
run; 

proc gplot DATA=class(KEEP=age height sex);
   plot height * age = sex / vaxis=axis1
   FRAME;
run;                                                                                                                                    
quit;

Upvotes: 2

Related Questions