zoukankan      html  css  js  c++  java
  • SAS--tabulate三线表

    proc tabulate data=clinic.stress2;
        var resthr maxhr ;
        table mean*(maxhr resthr);
    run;
    
    proc tabulate data=clinic.stress2;
        var resthr maxhr ;
        table mean*(maxhr resthr);
    run;    
    
    proc tabulate data=clinic.admit;
        class sex;
        var height weight;
        table sex,(height weight)*mean;
    run;
    
    proc tabulate data=clinic.admit;
        var height weight;
        class sex;
        table sex,(height weight)*mean;   
    run;                                    
    
    
    proc tabulate data=clinic.data;
        var height weight;
        class sex actlevel;
        table height;
        table sex, height;
        table sex,actlevel, weight height; /*一个comma增加一个维度*/
        table sex actlevel ,height;
    run;
    
    proc tabulate data=clinic.data;
        var height weight;
        class sex actlevel;
        table height;    /*默认sum*/
        table mean*height; /*asterisk指定统计方法*/
        table height*mean;/*顺序不一样显示不一样*/
        table sex*pctn,height;/*height没什么用*/
        table sex*n,height;
        table sex*n,height*mean;   *函数只能在一个维度中用;
        table sex,height*mean;
        table height*mean weight*max;
        where sex='F';    *sex可以不在class中;
    run;
    
    proc tabulate data=clinic.data;
            var fee;
            class sex;
            table sex all,fee*mean;   *all在行维度,添加了一个summary,eg:总体fee的均数;
     run;
    
     proc tabulate data=clinic.data;
            var fee;
            class sex actlevel;
            table sex all,actlevel all;   *all在行维度,添加一个summary,eg:总体fee的均数;
            title1 'Attendance in Exercise Therapies';
               footnote1 'March 1-15';
               label SEX='Walk/Jog/Run';  *注意label有=;
    run;
    
    proc tabulate data=clinic.data;
        var fee;
        class sex actlevel;
        table fee all ,actlevel all ;
        label actlevel='Action level';
        keylabel all='ALL'
                sum='合计';
    run;
    
    proc tabulate data=clinic.admit format=dollar6.; *默认format是12.2;
            class actlevel; 
            var fee;
            table fee all;
    
         run;
    
    
    proc tabulate data=clinic.admit ;
        class sex actlevel ;
        var height weight;
        table sex, weight*mean height*mean; 
        table sex all , actlevel*height*mean;  /**/
        table sex ,actlevel*height*pctsum<sex>;*计算了sex在每个actlevel水平下的百分比,而不是占总数的百分比;
        table sex, weight height,mean;
        table sex *(actlevel all);
        table sex ,actlevel,height; 
        table sex ,actlevel,height / condense;   *多页压缩城一页;
    run;
    
    /*加format*/
    proc format;
            value $actfmt 'LOW'='(1) Low'
                          'MOD'='(2) Moderate'
                          'HIGH'='(3) High';
        run;
    
        proc tabulate data=clinic.admit  order=formatted; *按照format里的顺序显示;
        class sex actlevel ;
        var height weight;
        table sex ,actlevel*height*pctsum<sex> ;*计算了sex在每个actlevel水平下的百分比,而不是占总数的百分比;
        format actlevel $actfmt.;
        table sex all , actlevel*height*mean / rts=6; *cehck the output rather than html;
        table sex all='total' , height*mean='均数'*actlevel *f=5.;/**/ *直接修改keylabel 和format;
    run;
    Valar morghulis
  • 相关阅读:
    微信公众号对接配置
    ASP.NET MVC5+EF6+EasyUI 后台管理系统(89)-国际化,本地化,多语言应用
    Nacos安装教程
    IDEA 中创建SpringBoot 父子模块
    解决死锁之路(终结篇)
    CentOS安装node和npm
    CentOS安装RabbitMQ
    在LibreOffice中插入代码
    PowerShell查找程序路径
    使用命令行调用控制面板的选项
  • 原文地址:https://www.cnblogs.com/super-yb/p/11774534.html
Copyright © 2011-2022 走看看