zoukankan      html  css  js  c++  java
  • SAS--chapter9描述统计(means freq)

    描述统计 means  /  freq

    libname clinic 'D:sas';
    proc means data=clinic.admit;
    run;               *num变量自动计算mean,sd,max,min;
    proc means data=clinic.admit median range; *prco means data=  statistic;
    run;
    proc means data=clinic.admit min maxdec=2; *最大的小数点为2;
    run;
    proc means data=clinic.admit ;
        var age height;           *指定变量 or  item1-item6;
    run;
    proc means data=clinic.admit ;
        var age height;  
        class sex;  *根据sex将数据分组,可以多个变量。该变量值必须是有限个个数,cha和num都可以; 
    run;
    
    
    proc sort data=clinic.admit out=clinic.admitsort;
        by sex actlevel;         
    run;
    proc means data=clinic.admitsort ;
        var height weight;
        by sex actlevel;     *类似与class,但是需要提前sort;
    run;
    
    *输出;
    proc means data=clinic.admit noprint;  *不打印上半部分;
        var age height;    
        class sex; 
            output out=work.data_gender    
            mean = aveage aveheight;      *输出 opt=libref.dataname mean=(输出均数),aveage=变量名;
    run;
    proc print data=work.data_gender;   *print刚刚的输出;
    run;
    proc freq data=clinic.admit2;  *数据集中每一个分类变量的频数,百分比,累计频数,累计百分比;
    run;
    proc freq data=clinic.admit2;  
        table paid  location;       *列出某些分类变量  or  table item1-item4;
    run;
    proc freq data=clinic.admit2 ;  
        table paid location /nocum;   *不显示累计频数和累计百分比;
    run;
    
    proc freq data=clinic.admit2 ; 
        tables paid*location;   *crosstable ,cells contain 频数,total freq,row f,column f;
    run;                        *还可以是 a*b*c,a为level,b is row , c is column:
    
    *combine format;
    proc format;
        value wtfmt low-139='< 140'
                    140-180='140-180'
                    181-high='> 180';
    
        value htfmt low-64='< 5''5"'
                    65-70='5''5-10"'
                    71-high='> 5''10"';
    run;
    proc freq data=clinic.diabetes;
        tables weight*height;
        format weight wtfmt. height htfmt.;
    run;
    
    proc freq data=clinic.admit2 ; 
        tables paid*location / crosslist;  *check the different with no crosslist;
    run;
    
    proc freq data=clinic.admit2 ; 
        tables paid*location / list;    *more compact and clear
    run;
    
    proc freq data=clinic.admit2 ; 
        tables paid*location / nofreq norow nocol;   *suppress table;
    run;
    proc means data=clinic.heart min max maxdec=1;
       var arterial heart cardiac urinary;
       class survive sex;
    run;
    
    
    proc summary data=clinic.diabetes;
       var age height weight;
       class sex;
       output out=work.sum_gender
          mean=AvgAge AvgHeight AvgWeight;
    run; 
    
    
    proc freq data=clinic.heart order=freq;
       tables sex*survive*shock / nopercent list;
    run;
    

      

    Valar morghulis
  • 相关阅读:
    激活Maven profile的几种方式
    利用maven的filter和profile实现不同环境使用不同的配制
    通过profile 用maven命令打不同配置的变量包
    使用Maven Profile实现多环境构建
    Window下Nexus私服搭建
    linux之nginx
    linux之命令进阶
    linux之常见命令
    flask中路由的本质源码分析
    vmware+CentOs 6.9的安装步骤
  • 原文地址:https://www.cnblogs.com/super-yb/p/11661723.html
Copyright © 2011-2022 走看看