DAY NAME VALUE
1 a 3
1 b 4
1 c 7
...
1 x 15
2 a 13
2 b 14
2 c 17
...
2 x 35
......
我想得到每天VALUE从大到小排列,前10%分位数那个观测值,然后将这些观测值按照横轴时间 纵轴VALUE连成线,曲线旁边还有标明NAME,请大侠门帮帮忙!作者: shiyiming 时间: 2010-1-14 01:54 标题: Re: 如果取出所要的数据? [code:1yy7ljdn]*generate the dataset;
data a;
length day 8 name $1 value 8;
letter = 'ABCDEFGHIJKLMNOPQRSTUVWX';
do day =1 to 10;
j=1;
do while(^missing(substrn(letter, j,1)));
name = substr(letter, j, 1);
value =int(ranuni(1)*50);
j+1;
output;
end;
end;
keep day name value;
run;
*find the 10% quantile;
proc univariate data =a noprint;
var value;
class day;
output out = b p10 = p10;
run;
proc sql;
create table c as
select a.day, a.name, a.value from a, b where a.day = b.day & a.value = b.p10;
quit;
*plot;
symbol i = join pointlabel =('#name');
proc gplot data = c;
plot value*day;
run;[/code:1yy7ljdn]
If values are not unique in the same day, you may find the multiple records for the p10.
*****JingJu*****作者: shiyiming 时间: 2010-1-14 11:12 标题: Re: 如果取出所要的数据? 厉害!!!