SAS 中的 Boxplot 使用 proc gchart [英] Boxplot in SAS using proc gchart
问题描述
第一个问题,是否可以在 SAS 中使用 proc gchart 生成箱线图?
First question, is it possible to produce a boxplot using proc gchart in SAS?
如果可能,请给我一个简短的想法.
If it is possible, please give me a brief idea.
或者,关于使用 proc boxplot 的主题.假设我有一个包含三个变量 ID score year 的数据集;类似的东西,
Or else, on the topic of using proc boxplot. Suppose I have a dataset that has three variables ID score year; something like,
data aaa;
input id score year;
datalines;
1 50 2008
1 40 2007
2 30 2008
2 20 2007
;
run;
我想为每年的每个 ID 生成一个箱线图.(因此在这种情况下,单个图中有 4 个箱线图)我怎样才能做到这一点?
I want to produce a boxplot showing for each ID in each year. (So in this case, 4 boxplots in a single plot) How can i achieve this?
我试过使用
proc boxplot data=aaa;
plot score*ID;
by year;
run;
但是,这不起作用,因为我们可以看到年份不是按顺序排序的.有没有办法得到其他这个?
However, this is not working as we can see year is not sorted by order. Is there a way to get other this?
推荐答案
您需要先对输入数据集进行排序.运行这个
You need to sort your input dataset first. Run this
proc sort data = aaa;
by year;
run;
然后你的 proc boxplot 应该像写的那样工作.
and then your proc boxplot should work as written.
这篇关于SAS 中的 Boxplot 使用 proc gchart的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!