楼主: caibirdcnb
20682 24

[问答] 请问高手用SAS如何做出以下图表,非常感谢! [推广有奖]

11
ziyenano 发表于 2012-12-31 11:33:42
data ex;
input week $;
n=_n_;
num1=round(ranuni(0)*100+400);
num2=round(ranuni(0)*100+300);
cards;
wk01
wk01
wk01
wk02
wk02
wk02
;
run;
proc sql noprint;
select cat(n,'=',quote(compress(week))) into:format separated by ' ' from ex;
select count(1) into:count from ex;
quit;
proc format;
value axis  &format;
run;

proc sgplot data=ex;
scatter x=n y=num1/markerattrs=(symbol=diamondfilled color=blue size=10);
scatter x=n y=num2/markerattrs=(symbol=squarefilled color=red size=10);
xaxis values=(1 to &count by 1) tickvalueformat=axis.;
yaxis grid values=(0 to 600 by 100 ) ;
run;

12
caibirdcnb 发表于 2013-1-1 01:56:45
ziyenano ,非常感谢!

根据你的指导,我修改了一下代码,效果图见图片。唯一的缺点就是不能每一周显示一个数字,而是一周有多个数字。

/*******************************************************************************************/
data test;
input Week EC $ Wafer $ Yield Input N;
datalines;
35        G        32CCB        0.75969        1781        1
35        I        25F2F        0.67953        4509        2
35        I        25F33        0.75215        2324        3
36        G        31C38        0.86103        1655        4
36        G        32527        0.84716        12850        5
36        G        3252C        0.83039        4251        6
36        G        32555        0.723        2769        7
36        G        3276C        0.83275        11390        8
36        G        32A8B        0.86513        3255        9
36        G        32A8F        0.8217        3466        10
36        G        32A90        0.77304        3798        11
36        G        32A91        0.78875        3413        12
36        G        32AA9        0.60618        3461        13
36        G        32AAC        0.8622        3106        14
36        G        32E5A        0.8231        831            15
36        G        32EE9        0.76768        891            16
36        G        32F3B        0.84331        919           17
36        H        32926        0.89561        820            18
36        I        2386E        0.72531        2547        19
36        I        3305C        0.63653        1593        20
36        I        33250        0.70183        1697        21
37        E        4F038        0.51043        1725        22
37        G        31A88        0.87808        812         23
37        G        31C38        0.81805        5320        24
37        G        31D2A        0.74186        1658        25
37        G        32555        0.72628        5060        26
37        G        325C6        0.86811        508         27
37        G        32B7F        0.77179        1560        28
37        G        32BCB        0.72298        1841        29
37        G        32E5A        0.91723        894         30
37        G        32EAC        0.87753        1780        31
37        G        32EB3        0.74673        1836        32
37        G        32EB6        0.84628        1763        33
37        G        32EE9        0.82094        1022        34
37        G        32F01        0.71214        1796        35
37        G        32F06        0.83528        856         36
37        G        32F18        0.76987        1673        37
37        G        32F3B        0.82124        772         38
37        H        32926        0.94324        4840        39

;
run;

proc sql noprint;
select cat(N,'=',quote(compress(put(week,2.)))) into:format separated by ' ' from test;
select count(1) into:count from nb.test;
quit;
proc format;
value axis  &format;
run;

/*******************************************************************************************/
proc template;
        define statgraph temp;
    begingraph /designwidth=9in designheight=6in;

    entrytitle 'Yield Trend By Wafer By EC';
    entryfootnote halign=center 'XXXX Confidential'
                              halign=right "XXXX";

    layout overlay / wallcolor=lightyellow
                yaxisopts=(label='Yield' offsetmin=0 offsetmax=0 griddisplay=on
                                        linearopts=(tickvalueformat=percent8.1
                                                        tickvaluesequence=(start=0 end=1 increment=0.05)
                                                        viewmin=0.5 viewmax=1))
                xaxisopts=(label='Week' griddisplay=on
                                        linearopts=(tickvalueformat=axis.
                                                                tickvaluesequence=(start=0 end=100 increment=2)));
        bubbleplot x=N y=Yield size=Input / group=EC
                        bubbleradiusmax=20 bubbleradiusmin=5 name='Y';

            layout gridded / columns=1 autoalign=(topright);
                     entry halign=left textattrs=(color=blue) "one point one wafer";
                        entry halign=left textattrs=(color=blue) "circle size represent qty";
            endlayout;
    endLayout;

    layout globallegend / type=column;
        discretelegend "Y" / title="EC:";
    endLayout;

        endgraph;                                                         
        end;
run;

/*******************************************************************************************/
ods listing close;
ods html style=default;
ods graphics on / reset=all;

proc sgrender data=test template=temp;
run;

ods html close;
ods listing;









bubble.jpg bubble.jpg

13
kittyforever 发表于 2013-1-6 15:50:51
学习

14
zhoushuai165 发表于 2013-1-9 20:48:41
得向各位学习啊
决定成败的是人

15
fage19830611 发表于 2013-1-22 02:58:21
{:soso_e100:}{:soso_e100:}

16
f1234321 发表于 2013-1-27 09:16:37

17
cp_gogo 发表于 2013-3-28 09:12:56
好东西~~谢谢分享~~
http://wenku.baidu.c ...

18
gaotao0727 发表于 2013-3-28 15:13:14
对SAS作图也曾研究一段时间,时间久了就忘记!算是复习了~~
衣带渐宽终不悔,为伊消得人憔悴~~

19
snowflower2011 发表于 2013-6-18 09:22:02

20
txyw 在职认证  发表于 2014-6-17 10:13:00
恩,SAS高版本才好用啊

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-29 11:10