我正试着按条件创建一个散点图。在下面的例子中,我有一些数据点(连续变量)是常见的范畴变量MAKE。因此,数据点正在被叠加,这使得我无法识别图形是否同时表示变量的存在,或者仅仅表示一个变量。
如何避免在SGPLOT过程中使用两个不同的符号,比如我们可以在GPLOT中使用的方式。SGPLOT I的示例代码使用:
proc sgplot data=sashelp.cars(where=(make in ('Dodge', 'Chrysler')));
scatter Y=mpg_city X=mpg_highway / group=make markerattrs=(symbol=plus);
run;我知道下面的代码可以工作,但是我想使用SGPLOT而不是GPLOT:
ods listing close;
SYMBOL1 VALUE=dot color=bib;
SYMBOL2 VALUE=square color=brown;
proc gplot data=sashelp.cars(where=(make in ('Dodge', 'Chrysler')));
plot mpg_city * mpg_highway =make ;
run;提前谢谢。
发布于 2016-04-05 18:01:10
当然是用了一个符号。是你说的!
如果您想要具体指定这两个标记,可以删除MARKERATTR=(symbol=代码,或者使用MARKERCHAR使其来自变量或属性映射数据集(DATTRMAP)。或者用颜色。
以下是几个例子:
*Using MARKERCHAR;
data cars;
set sashelp.cars;
if make = 'Dodge' then marker_char = '+';
else if make = 'Chrysler' then marker_char = 'o';
else delete;
run;
proc sgplot data=cars(where=(make in ('Dodge', 'Chrysler')));
scatter Y=mpg_city X=mpg_highway / group=make markerchar=marker_char;
run;
*Using an attribute map (most similar to the GPLOT example);
data attr_map;
length value markercolor $8;
id='MakeAttr';
value = 'Dodge';
markersymbol='plus';
markercolor='green';
output;
value='Chrysler';
markersymbol='circle';
markercolor='red';
output;
run;
ods html style=htmlblue;
proc sgplot data=sashelp.cars(where=(make in ('Dodge', 'Chrysler'))) dattrmap=attr_map;
scatter Y=mpg_city X=mpg_highway / group=make attrid=MakeAttr;
run;https://stackoverflow.com/questions/36433133
复制相似问题