我有两个关于SGPlot的问题。我有一个大的数据集,并试图创建一个散乱的情节,突出不同品牌之间的相似产品。我可以得到不同的颜色为每个品牌,但由于某种原因,符号将不会出现。我不得不关闭ods列表和html,因为我收到了一个错误:无法将图像写入filename.png。请确保设置了适当的磁盘权限。我不确定这个能不能解决。还有别的方法可以得到这些符号吗?
此外,我有一个95%的预测椭圆,但我想知道是否有一个方法有一个椭圆为每个品牌。谢谢。
data example;
length product brand $20;
input product $ brand $ item price trans;
cards;
sconces AllenRoth 1 1.5 300
sconces AllenRoth 2 2.75 350
sconces AllenRoth 3 1.75 300
sconces AllenRoth 4 0.75 400
sconces GardenTreasures 1 3 200
sconces GardenTreasures 2 3.25 175
sconces GardenTreasures 3 2.75 100
sconces GardenTreasures 4 3.5 100
sconces GardenTreasures 5 4 150
sconces OtherBrand 1 0.5 850
sconces OtherBrand 2 0.45 875
sconces OtherBrand 3 0.75 900
sconces OtherBrand 4 1 650
sconces OtherBrand 5 0.75 700
sconces BrandX 1 1 200
sconces BrandX 2 1.25 500
sconces BrandX 3 1.2 400
sconces BrandX 4 0.95 375
sconces BrandX 5 1 300
sconces BrandX 6 1 200
sconces BrandX 7 1.35 400
sconces BrandX 8 1.5 350
curtains AllenRoth 1 10 200
curtains AllenRoth 2 12 250
curtains AllenRoth 3 11.5 200
curtains AllenRoth 4 10 400
curtains AllenRoth 5 17 500
curtains AllenRoth 6 15 100
curtains AllenRoth 7 29 50
curtains AllenRoth 8 50 12
curtains GardenTreasures 1 80 150
curtains GardenTreasures 2 60 75
curtains GardenTreasures 3 100 50
curtains BrandX 1 9 300
curtains BrandX 2 12 350
curtains BrandX 3 10 275
curtains BrandX 4 7.5 400
curtains BrandX 5 12 200
curtains BrandX 6 8.5 500
;
run;
proc format;
value legfmt
1 = 'legend value 1'
2 = 'legend value 2'
3 = 'legend value 3'
4 = 'legend value 4';
run;
proc sort data= example;
by product brand;
run;
ods listing close;
ods html close;
proc sgplot data= example ;
title1 "plotting trans by price";
footnote1 "final";
by product;
scatter x= trans y= price / datalabel= item group= brand name= "scp";
ellipse x=trans y=price;
xaxis label= "Number of Transactions";
yaxis label= "Average Selling Price";
keylegend "scp" / noborder across= 1 down= 4 location= outside position= topright
title= "Legend";
run;
ods graphics off;
ods listing close;发布于 2014-05-29 13:56:51
可能您的路径设置不正确。这对我来说很有用,例如:
ods html path='c:\temp' file='test.html' gpath='c:\temp\' style=htmlblue;
proc sgplot data= example ;
title1 "plotting trans by price";
footnote1 "final";
by product;
scatter x= trans y= price / datalabel= item group= brand name= "scp";
ellipse x=trans y=price;
xaxis label= "Number of Transactions";
yaxis label= "Average Selling Price";
keylegend "scp" / noborder across= 1 down= 4 location= outside position= topright
title= "Legend";
run;
ods html close;如果不将gpath设置为可以写入的路径,则可能会将其设置为无法写入访问权限的路径,特别是如果您安装了服务器。路径和GPATH可以设置为相同或不同的路径。
我不相信每个品牌都有一个椭圆,很大程度上是因为它看起来糟透了。有四个预测椭圆,即使有不同的颜色,在视觉上也很难分辨。如果您试图显示这一点(例如,以brand作为条形图类型,销售价格桶作为组变量),则可能适合使用不同的图表类型。
https://stackoverflow.com/questions/23933574
复制相似问题