美文网首页
proc transpose

proc transpose

作者: 小丹丹的梦想后花园 | 来源:发表于2019-12-17 10:45 被阅读0次

    data score;

     input Student $9. +1 StudentID $ Section $ Test1 Test2 Final;

     datalines;

    Capalleti 0545 194 91 87

    Dubose  1252 251 65 91

    Engles  1167 195 97 97

    Grant 1230 263 75 80

    Krupski 2527 280 76 71

    Lundsford 4860 192 40 86

    McBane  0674 175 78 72

    ;

    proc transpose data=score out=idlabel name=Test prefix=sn;

     id studentid;

     idlabel student;

    run;

    proc print data=idlabel label noobs;

     title 'Student Test Scores';

    run;

    输出OUTPUT:

    ----------------------------------------------------

    以前的变量名 Capalleti Dubose Engles Grant Krupski Lundsford  McBane

     Test1   94  51   95   63   80   92   75

     Test2   91  65   97   75   76   40   78

     Final   87  91   97   80   71   86   72

    示例2:

    data sale;

    input salerid foodid money foodname $;

    cards;

    1 1 100 egg

    1 2 300 cake

    1 3 400 apple

    2 2 230 cake

    2 3 444 apple

    2 4 540 pear

    3 1 123 egg

    3 2 120 cake

    3 3 200 apple

    3 4 500 pear

    ;

    run;

    proc transpose data=sale out=saleout name=Saler prefix=Food;

     id foodid;

     idlabel foodname;

     by salerid;

    run;

    proc print data=saleout label noobs;

    run;

    输出OUTPUT:

    ----------------------------------------------------

    salerid  以前的变量名  egg  cake  apple  pear

     1    money  100 300 400  .

     2    money    . 230 444  540

     3    money  123 120 200500

    分享:

    相关文章

      网友评论

          本文标题:proc transpose

          本文链接:https://www.haomeiwen.com/subject/hocsnctx.html