医学统计学与SAS软.pptxVIP

  • 10
  • 0
  • 约1.23千字
  • 约 25页
  • 2023-01-31 发布于四川
  • 举报
SAS软件应用;SAS数据分析过程;一、SAS数据集与数据文件;1、数据集的建立 数据步 data a1; 数据步开始 input x y; 输入的变量 cards; 数据块开始(也可用infile 1 2 指定数据文件存储位置) 3 4 ; 数据块结束,必须单独占一行 run; 数据步结束语句(可以省略) Infile ‘e:\tmp.dat’;;;2、sas与其他数据文件格式的导入和导出 导入数据 import过程 proc import out=a3 datafile=e:\tmp.xls dbms=excel replace; run; 导出数据export过程 proc export data=sashelp.class outfile=e:\stu.csv dbms=csv replace; run;;二、数据集整理(数据加工);;data a5; set sashelp.clss; bmi=(weight/2)/(height/100);数据加工语句 run;;2、数据集选项;3、对观测的选择 If语句 If 表达式 then 语句; else 语句;;4、常用的运算符; data a6; set sashelp.class; if ^(sex=男) then w=低体重; else w=高体重; run;;5、where 表达式 data a7; set sashelp.class(where=(sex=男)); run; proc print data=a7; run;;6、按变量值对数据集排序;7、用sas语句生成新变量 a 赋值语句 b 使用sas函数 Total=sum(weight,height);c 求和语句 data a8 ; set sashelp.class; i+1; run; ;8、do – end语句 ;9、sas函数 ;常用的函数 ;data a9; name = tomas; name2 = upcase(name); run; proc print data=a9; run;;data a9; x1 = good; x2 = bad; x3 = middle; x4 = x1 || || x2 || || x3; run; proc print data=a9; run;;10、循环语句;data a10 ; do a=1 to 20 by 2; x = a*10; output; end; run;;data a11; do i=1 to 100; x=rannor(12345); y=rannor(12345)*5.2+25; output; end; run;

文档评论(0)

1亿VIP精品文档

相关文档