如何在SAS中将群集绘制成散点图?

时间:2018-09-27 19:15:18

标签: sas

我使用以下代码创建了一个名为clusteringds的数据集;

DATA clusterds;
INPUT ID$ title$ name$ age$ marital_status$ salary% postcode$ ethnic_origin$;
CARDS;
{Inserts Data Here}
run;

然后我使用下面的代码根据ID对行进行聚类;

proc fastclus data = clusteringds maxc=5 maxiter=10 out=clus;
run;

这有助于创建一个名为Clus的数据表,该数据表是表clusteringds和另一个名为clusters的变量的组合,其中每一行都是从1到5的簇号。

我想通过情节描绘这些集群。我相信执行此操作的代码包括:

proc &gplot data = clusteringds;
scatter;
run; 
quit;

但是我不确定如何完成我的情节。有人可以帮忙吗?

1 个答案:

答案 0 :(得分:0)

散点图可以显示两个或三个(气泡)或4(气泡+颜色),但随后变得非常繁忙。

让我们从一个简单的散点图开始吧

proc sgplot data=clus; *note you need to use the output data set here;
   scatter x= marital_status y=salary / group = cluster; *you may need to verify the cluster name;
   run; quit;