在我从http://support.sas.com/kb/46/723.html读取代码后,我想创建具有不同类别的2行,下面是我的数据:
x y类别
7 7 1
4 6 1
1 5 1
6 4 2
3.5 3 2
0.5 1 2
但是我无法创建具有不同类别的两行,下面是我的代码
/* 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;
我的预期结果应该在一个图表中有2行不同的类别,我的代码应该怎么写?请帮忙,谢谢。
答案 0 :(得分:2)
尝试这样的事情:
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;