22
[email protected] 生生 生生生生 SAS SAS 生生 生生 [email protected]

生物统计教研室

  • Upload
    nascha

  • View
    66

  • Download
    12

Embed Size (px)

DESCRIPTION

SAS 概述. 生物统计教研室. [email protected]. 常用统计软件包简介. SAS 统计分析系统( Statistical Analysis System ) SPSS 统计软件包( Statistical Package for the Social Science ---Renamed as…Predictive Analytics- 预测分析技术提供者) - PowerPoint PPT Presentation

Citation preview

Page 1: 生物统计教研室

[email protected]

生物统计教研室

SASSAS 概述概述

[email protected]

Page 2: 生物统计教研室

[email protected]

常用统计软件包简介

SAS 统 计 分 析 系 统 ( Statistical Analysis Syste

m ) SPSS 统计软件包( Statistical Package for the

Social Science ---Renamed as…Predictive Analytics- 预测分析技术提供者)

Stata: A full data-management system with complete statistical and graphical capabilities (http://www.stata.com/)

S-plus: The premier solution for exploratory data modeling and statistical analysis.

PEMS 统计软件包 (Package for encyclopaedia of medical statistics) NoSA…

Page 3: 生物统计教研室

[email protected]

SAS 概述

• SAS—Statistical Analysis System 美国 SAS 软件研究所( SAS Institute Inc )

(近二十八年来, SAS 始终致力于为全球客户提供理性决策的力量 The Power to Know )

• 国际上通用的数据分析的标准软件权威性的统计分析软件

(按行业划分的全球客户群企业:商业: 73.3% ;教育机构: 16.8% ;政府部门: 9.9%)

Page 4: 生物统计教研室

[email protected]

SAS 概述

SAS 优点:1. 国内外通用2. 数据管理功能全面,方便3. 大型统计软件包→数据分析功能齐全4. 窗口管理系统→直观和方便

Page 5: 生物统计教研室

[email protected]

案例

• 中国海关使用 SAS 来审核偷税漏税、指导地方当局打击走私 (http://www.sas.com/offices/asiapacific/china/success/technology.html#DataMiningandStatisticalAnalysis)

• 上海宝钢使用 SAS 软件来提高产品质量和改进供货流程 (在竞争中领跑)(http://www.sas.com/offices/asiapacific/china/success/shanghaibaosteel.html)

解决方案: SAS 解决方案,包括 SAS/IntrNet 和Enterprise Miner ,增强数据仓库、数据挖掘和在线报告技术和服务。

Page 6: 生物统计教研室

[email protected]

SAS 功能

• 分析智能 : 数据挖掘和统计分析

预测和计量经济学 运筹调研 质量改进

• 商业智能 :

应用开发 | 内容提供 | 查询和报表

• 数据仓库 :

SAS/BASE ( Core )

STAT

Page 7: 生物统计教研室

[email protected]

医学统计中的应用

• 为绝大多数医学研究所采用

• 论文上写明: “ 采用 SAS… 进行数据的统计分析”

Page 8: 生物统计教研室

[email protected]

SAS 安装

根据安装说明,要拷入“ C:\Program Files” 文件夹 : C:\Program Files\SAS Institute\SAS\V8

参考程序• 教材例题程序和所用到的数据文件安装在“ C:\

Program Files\SAS Institute\SAS\SASCLASS” 文件夹中

• 附录一上机实习题参考程序和所用数据文件安装在“ C:\Program Files\SAS Institute\SAS\SASEXER”文件夹中

Page 9: 生物统计教研室

[email protected]

如何进入 SAS ?方法:

1. 在 Windows 桌面双击“ SAS 快捷方式”。

2. C:\Program Files\SAS Institute\

SAS\V8子目录中双击 sas.exe

运行 SAS

Page 10: 生物统计教研室
Page 11: 生物统计教研室

[email protected]

===SAS windows===

– EditorWhere code is written or imported, and submitted

– LogWhat happened, including what went wrong

– OutputResults of procedures in the program…

– ExplorerShows libraries, their files, and where you can see

data, graphs etc

– ResultsShows how the output is made up of tables,

graphs, datasets etc

Page 12: 生物统计教研室

[email protected]

SAS 实际操作界面

编写程序:程序编辑窗口

运行程序: F8 | F3 | Submit | Run 小人图标

看运行信息: LOG 窗口 (有无红字等警告信息)

看运行结果: OUTPUT 窗口

Page 13: 生物统计教研室

[email protected]

实习内容

• (参考第二章、第三章)

上机实习 1 :熟悉 SAS 操作界面上机实习 2 : SAS 数据集的建立上机实习 3 :计量资料的描述性统计

SAS 安装现场演示 程序示例与解读

Page 14: 生物统计教研室

DATA steps are typically used to create SAS data sets.

PROC steps are typically used to process SAS data sets (that is, generate reports and graphs, edit data, and sort data).

A SAS program is a sequence of steps that the user submits for execution.

RawData

RawData

DATAStep

DATAStep ReportReport

SASData Set

SASData Set

PROCStep

PROCStep

SAS Programs

Page 15: 生物统计教研室

住院号 年龄 身高 体重 住院天数 职业 分娩方式 妊娠结局20256

55 27165

71.5 5 无 顺产 足月

2025653 22

160

74.0 5 无 助产 足月

2025830 25

158

68.0 6 管理员 顺产 足月

2022543 23

161

69.0 5 无 剖宫产 足月

2022466 25

159

62.0 11 商业 剖宫产 足月

2024535 27

157

68.0 2 无 顺产 早产

2025834 20

158

66.0 4 无 助产 早产

2019464 24

158

70.5 3 无 助产 足月

2025783 29

154

57.0 7 干部 剖宫产 足月

观察单位observations

个体

数值型变量 :age…

字符型变量: job $...

变量variables

数据结构建立( Excel)

Page 16: 生物统计教研室

①统计表格格式 (收集原始数据)

序号 第 1组

第 2组

第 3组

1 0.1 0.4 0.62 0.2 0.5 0.73 0.3   0.84   0.9

样本量 3 2 4

组别 变量值1 0.11 0.21 0.32 0.42 0.53 0.63 0.73 0.83 0.9

②统计分析格式

组别 1 2 3 4第 1 组 0.1 0.2 0.3

第 2 组 0.4 0.5

第 3 组 0.6 0.7 0.8 0.9

数据(集)格式

OK

Page 17: 生物统计教研室

[email protected]

*Method AMethod A ;data a; input sex age tc tg ldl hdl apoa apob chd;cards;1 55 4.17 1.38 2.38 1.16 143.4 93.7 11 50 5.81 6.20 1.88 1.09 144.3 96.1 1…1 52 5.09 0.74 3.23 1.63 120.8 131.0 0;

proc print data=a; run;

SAS 数据集的建立 SAS 数据集的建立

*Method BB: From Execel sheet to SAS dataset;*Method BB: From Execel sheet to SAS dataset;

Page 18: 生物统计教研室

Raw Data

Read in Data

Process Data(Create new variables)

Output Data(Create SAS Dataset)

Analyze Data Using Statistical Procedures

Data Step

PROCs

Page 19: 生物统计教研室

[email protected]

data shg; input x @@;cards;108.0 97.6 103.4 101.6 104.4 98.5.....99.8 108.3 104.0 100.6 112.6 103.7;run;

proc means data=shg n mean std min max; var x; run;

DATA Step

PROC Steps

SAS Programs

Page 20: 生物统计教研室

[email protected]

SAS语句和 SAS 程序

1 . SAS语句 SAS语句由关键字、 SAS名、特殊字符或运算符组成,并以分号(;)结尾。 SAS语句可以一行写一个语句,也可以一行写多个语句。

2 . SAS名SAS名由 1-8个字符组成,且必须以字母或下划线开头,后续字符可以是字母、数字或下划线。

3. 系统保留名:系统采用开头与结尾均以下划线作标记的 SAS名,如: _NULL_ 、 _N_ 。

Page 21: 生物统计教研室

[email protected]

DATA & PROC STEPS

• DATA STEPCreate a dataset which SAS

can use

• PROC STEPDo something to the datasetPrinting, Graphing, Analyzing

Page 22: 生物统计教研室

[email protected]

Problems

Bad syntax

Missing “ ; ” at end of line

SAS Program-初学者常见错误