统计软件SAS教程 SAS代码
libname dy 'd:\dzwj';
data dy.by_student;
proc print data=dy.c9501;
by sex; /*分类*/
run;
proc print;
run;
libname dy 'd:\dzwj';
data dy.bkmoney;
input name $ amount;
cards;
李明 20
张红艺 15
王思明 10
张聪 20
刘颖 50
;
run;
proc print;
run;
libname dy 'd:\dzwj';
data dy.sum_bkmoney;
proc print data=dy.bkmoney noobs; sum amount;/*sum函数求和*/
run;
libname dy 'd:\dzwj';
proc sort data=dy.c9501;
by name;
proc sort data=dy.bkmoney;
by name;
data dy.c9501bk;
merge dy.c9501 dy.bkmoney;/*merge横向合并*/ by name;
run;
proc sort data=dy.c9501bk;
by sex;
proc print data=dy.c9501bk;
by sex;
sum amount;
run;
libname dy 'd:\dzwj';
data dy.table_c9501bk;
proc tabulate data=dy.c9501bk;
class sex;
var amount;
table sex,amount;
run;
proc print;
run;
libname dy 'd:\dzwj';
data dy.table_c9501bk1;
proc tabulate data=dy.c9501bk;
class sex;
table sex;
run;
proc print;
run;
libname dy 'd:\dzwj';
anstd_c9501;
proc tabulate data=dy.c9501bk;
class sex;
var math chinese;
table sex,(math chinese)*(mean std); /*求变量的均值*/
run;
proc print;
run;
libname dy 'd:\dzwj';
anstd_c9501;
proc tabulate data=dy.c9501bk;
class sex;
var math chinese;
table all sex,(math chinese)*(mean std); /*求所有的变量的均值*/
run;
proc print;
run;
libname dy 'd:\dzwj';
anstd_c9501;
proc tabulate data=dy.c9501bk;
class sex;
var math chinese;
table (sex all)*(N PCTN); /*频数分布*/
run;
proc print;
run;
libname dy 'd:\dzwj';
anstd_c9501;
proc tabulate data=dy.c9501bk;
class sex;
dz模板安装教程var math chinese;
table (sex all)*math*(mean std); /*指定变量的均值和方差*/
run;
proc print;
run;
libname dy 'd:\dzwj';
anstd_c9501;
proc tabulate data=dy.c9501bk;
class sex;
var math chinese;
table (sex all),(math chinese)*(mean std); /*统计量加标签*/
keylabel mean='平均值' std='标准差' all='总计';
label sex='性别' math='数学' chinese='语文';
run;
proc print;
run;
libname dy 'd:\dzwj';
anstd_c9501;
proc tabulate data=dy.c9501bk;
class sex;
var math chinese;
table (sex all='总计'),(math chinese)*(mean='平均值' std='标准差'); /*统计量加标签,标签加在其中*/
label sex='性别' math='数学' chinese='语文';
run;
proc print;
run;
libname dy 'd:\dzwj';
data dy.by_sex;
proc sort data=dy.c9501;
by sex;
run;
proc print;
run;
libname dy 'd:\dzwj';
data dy.by_sex;
proc sort data=dy.c9501;
by sex descending math;
run;
proc print;
run;
libname dy 'd:\dzwj';
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论