中国人民大学 统计学院 王 剑

7
中中中中中中 中中中 中中中中中中 中中中 From SAS to R

Upload: mauli

Post on 05-Jan-2016

122 views

Category:

Documents


0 download

DESCRIPTION

From SAS to R. 中国人民大学 统计学院 王 剑. 既熟悉 SAS ,又熟悉 R. 你属于哪一类 ?. 熟悉 SAS , 但不熟悉 R. 不熟悉 SAS ,但熟悉 R. 既不熟悉 SAS ,也不熟悉 R. SAS 和 R 的本质区别. SAS Reads one observation at a time. R Requires all the data to be in memory. Code. R. SAS. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: 中国人民大学 统计学院 王    剑

中国人民大学 统计学院中国人民大学 统计学院王 剑王 剑

From SAS to R

Page 2: 中国人民大学 统计学院 王    剑

你属于哪一类 ?

既熟悉 SAS ,又熟悉 R

熟悉 SAS , 但不熟悉 R

不熟悉 SAS ,但熟悉 R

既不熟悉 SAS ,也不熟悉 R

Page 3: 中国人民大学 统计学院 王    剑

SAS 和 R 的本质区别

RRequires all the data

to be in memory

SASReads one observation

at a time

Page 4: 中国人民大学 统计学院 王    剑

Code

Data Example;input Name$ X1-X2;Xm= mean(Of X1-X2);cards;Zhao 22 98Wang 24 96;proc print;run;

SASR

Example=data.frame(Name=c("Zhao","Wang"), X1=c(22,24),X2=c(98,96))mean(Example[,2-3])

Name X1 X21 Zhao 22 982 Wang 24 96

X1 X2 23 97

Obs Name X1 X2 Xm1 Zhao 22 98 602 Wang 24 96 60

Output

Page 5: 中国人民大学 统计学院 王    剑

FREE

SAS R

Data Structure

Rectangular data setRectangular data

frame, vector, matrix, list.

Choosing data

All the data for an analysis must be in a

single data set

Analyses can freely combine variables from different data frames or other structures.

ChoosingObservation

s

Uses logical conditions in IF,

SELECT IF, WHERE

Uses wide variety of selection by index

value, variable name, logical condition

-—— R for SAS SPSS users, Bob Muenchen

Page 6: 中国人民大学 统计学院 王    剑

SAS 的五大部分

Statistical and graphical procedures

Data input and management statements

Output Delivery System

A macro language

A matrix language to add new algorithms(IML)

Data Example;input Name$ X1-X2;Xm= mean(Of X1-X2);cards;Zhao 22 98Wang 24 96;proc print;run;

SAS

Page 7: 中国人民大学 统计学院 王    剑