SAS?????? - PowerPoint PPT Presentation

About This Presentation
Title:

SAS??????

Description:

Title: PowerPoint Author: ZYH Last modified by: qy Created Date: 11/28/2000 1:24:23 AM Document presentation format: Other titles – PowerPoint PPT presentation

Number of Views:110
Avg rating:3.0/5.0
Slides: 70
Provided by: zyh
Category:
Tags: sas

less

Transcript and Presenter's Notes

Title: SAS??????


1
SAS??????
SAS???
2
??? SAS???????
  • PROC
  • BY
  • CLASS
  • VAR
  • WEIGHT
  • FREQ
  • ID
  • FORMAT
  • LABEL
  • OUTPUT
  • TITLE
  • FOOTNOTE
  • OPTIONS

3
6.1 PROC ??
  • ????
  • PROC ltSAS???gt???
  • ??
  • ?????????????????????
  • ???
  • ???
  • ????
  • ???SAS???,? DATA???

4
  • ?
  • proc means dataa mean std stderr maxdec3

5
6.2 BY??
  • ????
  • BY DESCENDING ??NOTSORTED
  • ??
  • ?????????????????
  • ?proc print by class descending tot
  • ??
  • BY???????SORT??????,???????????????

6
6.3 CLASS??
  • ????
  • CLASS ???
  • ??
  • ????????
  • ??
  • ??????????????????,???????????????BY??,????????

7
6.4 VAR??
  • ????
  • VAR ???
  • ??
  • ?????????
  • ??
  • ??????,???????????

8
6.5 WEIGHT??
  • ????
  • WEIGHT ??
  • ??
  • ????????????,??????????????

9
6.6 FREQ ??
  • ????
  • FREQ ??
  • ??
  • ????????,???????????????????
  • ??
  • ???????????FREQ?????

10
? DATA B INPUT SEX AGE NUMBER
CARDS F 20 10
F 22 23 M 21 19
M 22 16 PROC MEANS
VAR AGE PROC MEANS
FREQ NUMBER VAR
AGE
11
(No Transcript)
12
6.7 ID ??
  • ????
  • ID ???
  • ??
  • ???????,?????????????????
  • ?PROC PRINT DATAA
  • PROC PRINT DATAA
  • ID NAME

13
(No Transcript)
14
(No Transcript)
15
6.8 FORMAT ??
  • ????
  • FORMAT ?? ??
  • ??
  • ???????????????
  • ??
  • ?????????????????
  • PROC PRINT DATAA
  • FORMAT H 6.2 W 5.2
  • ?????????
  • FORMAT SEX SEXFMT.

16
(No Transcript)
17
  • DATA EMPLO
  • INPUT NAME T DATE7.
  • CARDS
  • zhongli 15jan84
  • liuwei 03mar85
  • proc print
  • FORMAT T WORDDATE.
  • run

18
6.9 LABEL ??
  • ????
  • LABEL ??
  • ??
  • ???????,??????????????????????
  • ??
  • ??????????LABEL???,???????????????????
  • ???????,????????????????????

19
6.10 OUTPUT??
  • ????
  • OUTPUT OUT???? ????????
  • ??
  • ???????????SAS????
  • ??
  • ????????????????????,???????????????
  • ????OUTPUT????????????????????????

20
6.11 TITLE??
  • ????
  • TITLEn ????
  • ?? ?????SAS?????????
  • ??
  • n???????,110,????1?
  • ?????????????????
  • ??????The SAS System?
  • ???????????????,??????????????????????

21
  • ???????? TITLE
  • ???n?????????TITLEn
  • ?????????????,????????RUN????????DATA?PROC?RUN????
    ??????
  • ?1PROC PRINT
  • TITLE 'TITLE FOR FIRST PROC'
  • PROC MEANS
  • ?2PROC PRINT DATA A
  • RUN
  • TITLE 'TITLE FOR SECOND PROC'
  • PROC MEANS

22
6.12 FOOTNOTE??
  • ????
  • FOOTNOTEn????
  • ?????????????????
  • ??
  • n?????????,110,????1?????????????????
  • ?????????????????
  • ?????????????????,?????FOOTNOTE?????????

23
  • ? PROC PRINT DATA A
  • TITLE1 'THIS IS '
  • TITLE2 'A DATASET'
  • FOOTNOTE 1 '------------'
  • FOOTNOTE 2 'END'
  • RUN

24
(No Transcript)
25
??? SAS????
  • SAS ????????????,??????????????
  • PRINT
  • FORMAT
  • SORT
  • DBF
  • TRANSPOSE
  • STANDARD

26
7.1 PRINT ??
  • PRINT ????
  • PROC PRINT DATA??? NOOBS LABEL
  • VAR ???
  • ID ??
  • LABEL ???
  • SUM ???
  • BY ??
  • WHERE ???

27
  • ?1????????????????????????????????,
    ?????????????????????????????
  • DATA A
  • INPUT NAME 15. D W EARN EXP _at__at_
  • CARDS
  • LILING A 1 5500 4700
  • LIUHONG B 2 4600 4000
  • PROC SORT BY D W
  • PROC PRINT
  • BY D W
  • SUM EARN EXP

28
(No Transcript)
29
(No Transcript)
30
7.2 FORMAT??
  • 7.2.1 ??
  • ??
  • ??????????????????????
  • ??
  • DATA??FORMAT?PUT??????FORMAT??????????????
  • FORMAT????????
  • ????? ??????????(???????????????????)
  • ???????????????

31
  • DATA SCORE
  • LENGTH NAME 12
  • INPUT NAME SEX GROUP T1-T3 _at__at_
  • SSUM(OF T1-T3)
  • CARDS
  • WANGDONG 1 1 90 70 60 XUEPING 2 2 85 95 88
  • ZHOUHUA 1 1 77 84 69 HEYAN 1 2 95 78
    88
  • SUNHONG 2 3 89 97 87 ZHAOBIN 2 3 66 98
    86
  • PROC FORMAT
  • VALUE SEXFMT 1'MALE' 2'FEMALE'
  • PROC PRINT DATASCORE
  • FORMAT SEX SEXFMT.
  • RUN

32
  • 7.2.2 ????
  • ??FORMAT???????????????
  • PROC FORMAT ???
  • VALUE ??? ??1?????1

  • ??2?????2
  • 1. PROC FORMAT ???
  • ??????????
  • LIBRARY????
  • 2.VALUE ??? ??1?????1

  • ??2?????2

33
VALUE???????????,????????????????????????????????
???????VALUE?????????,???FORMAT???,???????VALUE???
??????
  • ????VALUE?????????
  • VALUE ABC 1A 2B 3C
  • VALUE AGEFMT
  • LOW-12CHILD 13-19TEENS
  • 20-HIGHADULT
  • VALUE SEXFMT 1MALE
  • 2FEMALE OTHERMISCODED

34
  • VALUE GRADE 'A''GOOD'
  • 'B'-'D''FAIR'
  • F'-H''SEE INSTRUCTOR'
  • OTHER'MISCODED'
  • VALUE LOW-10'-10'
  • 10lt-20'-20'
  • 20lt-HIGH'20'

35
  • 7.2.3 ????
  • PROC FORMAT
  • VALUE SEXFMT 1FEMALE 2MALE
  • VALUE AGEFMT LOW-20'-20' 20lt-45'-45'

  • 45lt-HIGH'45'
  • DATA A
  • INPUT NAME SEX AGE V _at__at_
  • FORMAT AGE AGEFMT. SEX SEXFMT.
  • CARDS
  • wangdong 1 24 4300 xueping 2 18 4500
  • PROC MEANS
  • CLASS SEX AGE
  • VAR V
  • RUN

36
(No Transcript)
37
??? ??????
  • MEANS????????????????
  • SUMMARY????????????????
  • UNIVARIATE?????,??
  • TABULATE?????????
  • CORR????????
  • FREQ??????,??????
  • CHART?????????????
  • PLOT ????????

38
8.1 MEANS ??
  • ??
  • ????????????????????????,????????

39
8.1.1????
  • MEANS ????????
  • PROC MEANS ?????
  • VAR ???
  • BY ???
  • CLASS ???
  • FREQ ??
  • WEIGHT ??
  • ID ???
  • OUTPUT ???

40
  • PROC MEANS ?????
  • PROC MEANS????????????
  • DATA SAS???
  • NOPRINT
  • MAXDECn ???????????(08),???2
  • VARDEF?? ???????????,????VARDEFDF?

41
  • Statistic list ?????
  • MEANS???????????21?,?????????N?MAEN?MAX?MIN?STD?S
    TDERR?SUM?VAR?USS?CSS?NMISS?RANGE?T?PRT?SUMWGT?CV?
    SKEWNESS?KURTOSIS?CLM?LCLM?UCLM?
  • ????N?MIN?MAX?MEAN?STD?

42
  • OUTPUT ??
  • OUTPUT ???
  • OUTPUT????MEANS???????????????SAS?????
  • OUTPUT?????????
  • OUTSAS-dataset(SAS???)
  • output-statistic-list (???????)
  • ? PROC MEANS
  • VAR X1 X2
  • OUTPUT OUTSTATS
  • MEANMX1 MX2
    STDSX1

43
FREQ ??
  • ????
  • FREQ ??
  • ??
  • ????????,???????????????????
  • ??
  • ???????????FREQ?????

44
? DATA B INPUT SEX AGE NUMBER
CARDS F 20 10
F 22 23 M 21 19
M 22 16 PROC MEANS
VAR AGE PROC MEANS
FREQ NUMBER VAR
AGE
45
(No Transcript)
46
  • MEANS???1
  • DATA SCORE
  • LENGTH NAME 12
  • INPUT NAME SEX GROUP T1-T3 _at__at_
  • SSUM( OF T1-T3)
  • CARDS
  • SUNHONG 2 3 89 97 87
  • ZHAOBIN 2 3 66 98 86
  • WANGDONG 1 1 90 70 60
  • XUEPING 2 2 85 95 88
  • ZHOUHUA 1 1 77 84 69
  • HEYAN 1 2 95 78 88
  • HUANGSHAN 2 3 67 75 76

47
  • proc means datascore maxdec3
  • var t1 t2 t3
  • class group
  • title 'statistics with class variable'
  • proc sort datascoreby group
  • proc means maxdec3
  • by group
  • var t1 t2 t3
  • title 'statistics with by variable'
  • Run

48
(No Transcript)
49
(No Transcript)
50
?2. 40???????????????,??????????,??????
???? 14 18 116 132 164 1128 1256 1512
? ? 1 5 6 2 7 10 4 5
51
??
  • ?????????,?????????????YLOG10(X)
  • ????????????????????,???MEANS???????????,???????OU
    TPUT???MEANS???????(?????)?????SAS????,???????????
    ??????,?????NOPRINT????
  • ???F????(?????????)?
  • ?????????????????

52
  • DATA A
  • INPUT F X _at__at_
  • YLOG10(X)
  • CARDS
  • 1 4 5 8 6 16 2 32 7
    64 10 128
  • 4 256 5 512
  • PROC MEANS NOPRINT
  • VAR Y
  • FREQ F
  • OUTPUT OUTB MEANMY
  • DATA C
  • FILE PRINT
  • SET B
  • MX10MY
  • PUT MX

53
?3. ??????,??20 ???????,??????FIT.DAT
???????????95??????
  • ??
  • (1) ?????????,?????????
    ?????95??????a??0.05?

54
  • (2)???(MEAN)????(STDERR)??????(N)??MEANS????,?
    ?????????????????
  • (3) ??????????TINV????? t(1- a/2,df) ? t(1-
    a/2,df) TINV(1-a/2,df)??(N)?????(df)???????????
    ?

55
  • DATA STUDENT
  • INFILE AFIT.DAT'
  • INPUT H
  • PROC MEANS MEAN STDERR N NOPRINT
  • OUTPUT OUTB MEANMH STDERRSH NNUM
  • DATA CAL
  • SET B
  • TTINV( 0.975,NUM-1)
  • INTSH
  • LLMH-IN
  • ULMHIN
  • PUT LL UL
  • RUN

56
8.2 FREQ ??
  • 8.2.1 ??
  • FREQ???????n?????????,?????????????
  • ? SCORE??????????,?VFMT.????????????A?B?C??,?FREQ
    ??????????????????????????

57
  • PROC FORMAT
  • VALUE VFMT LOW-lt80'C'
  • 80-lt90'B'
  • 90-HIGH'A
  • DATA B
  • SET SCORE
  • VMEAN(OF T1-T3)
  • PROC FREQ DATAB
  • FORMAT V VFMT.
  • TABLES V

58
  • 8.2.2 ????
  • PROC FREQ ????????
  • PROC FREQ ?????
  • TABLES ???/???
  • WEIGHT ??
  • BY ??
  • OUTPUT ???

59
  • PROC FREQ ?????
  • DATASAS???
  • ORDERFREQDATAINTERNAL
  • FORMATTED
  • FORMCHAR(1,2,7)???
  • ???????????????????????(1)???(2)???(3)?
    ?????????
  • ??, FORMCHAR(1,2,7)-
  • PAGE ???????

60
TABELS ??? lt/???gt
  •   (1)??? (request-list) ???????????????????
    ???????????????????????,???????????????????
    ?
  • ?????????TABLES????????????? ? TABELS X
  • ???????TABELS?????????????????????????????????
    ??????
  • ? TABLES A B

61
  • ?n?????TABELS????????????n??????????????????,?
    ?????????????,??????????(?????)?????,?????????????
    ?
  • FREQ??????TABLES??,??TABLES????????????

62
  • (2)???
  • ?TABLES ?????(/)?????????????,??????????????
  • 1) ?????
  •  ? MISSING??????????????,?????????????????
    ????
  • ? LIST????????????????????????????????????
    ?,????LIST????

63
  • 2) ??????????
  • ? CHISQ ????(?2 )?????????????????Pearson???????
    ?????-???(Mantel-Haenszel)?????????(
    phi)??,??????????V(Cramerv )??? 22
    ???????(Fisher)?????
  • ? EXACT?????22????Fisher?????

64
  • 3) ????????????
  • ?    EXPECTED???????(???)??????????
  • ?    DEVIATION???????????????????
  • ? CELLCHI2???????????2 (??)??????

65
  • 4) ???????
  • ? NOFREQ ?????????????
  • ? NOPERCENT?????????????

66
  • 8.2.4 ??
  • DATA A
  • INPUT A B _at__at_
  • CARDS
  • 1 2 2 1 . 2 . . 1 1 2 1
  • PROC FREQ
  • TABLES AB
  • TITLE '2-WAY CONTINGENCY TABLE'
  • PROC FREQ ORDERDATA
  • TABLES AB /LIST
  • TITLE '2-WAY FREQUENCY TABLE, ORDERDATA'

67
(No Transcript)
68
(No Transcript)
69
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com