(1)读入数据时,INPUT var1 $12. 和Informat var $12. 的区别
如读入数据集:
Albany/NY/43/-74 Albuquerque/NM/36/-106 Amarillo/TX/35/-102 Anchorage/AK/61/-150 Annapolis/MD/39/-77 Atlanta/GA/34/-84 Augusta/ME/44/-70 Austin/TX/30/-98 Baker/OR/45/-118 Baltimore/MD/39/-76 Bangor/ME/45/-69 Baton Rouge/LA/31/-91 Birmingham/AL/33/-87 Bismarck/ND/47/-101 Boise/ID/43/-116
程序1:
DATA dataset1;
INFILE '..../../aa.txt' DLM='/';
INPUT var1 $ var2 $ var3 var4;
RUN;
程序2:
DATA dataset1;
INFILE '..../../aa.txt' DLM='/';
INPUT var1 $12. var2 $2. var3 var4;
RUN;
程序3:
DATA dataset1;
INFILE '..../../aa.txt' DLM='/';
INFORMAT var1 $12. var2 $2.;
FORMAT var1 $12. var2 $2.;
INPUT var1 $ var2 $ var3 var4;
RUN;
Obs
|
Var1
|
Var2
|
Var3
|
Var4
|
1
|
Albany
|
NY
|
43
|
-74
|
2
|
Albuquer
|
NM
|
36
|
-106
|
3
|
Amarillo
|
TX
|
35
|
-102
|
4
|
Anchorag
|
AK
|
61
|
-150
|
5
|
Annapoli
|
MD
|
39
|
-77
|
6
|
Atlanta
|
GA
|
34
|
-84
|
7
|
Augusta
|
ME
|
44
|
-70
|
8
|
Austin
|
TX
|
30
|
-98
|
9
|
Baker
|
OR
|
45
|
-118
|
10
|
Baltimor
|
MD
|
39
|
-76
|
11
|
Bangor
|
ME
|
45
|
-69
|
12
|
Baton Ro
|
LA
|
31
|
-91
|
13
|
Birmingh
|
AL
|
33
|
-87
|
14
|
Bismarck
|
ND
|
47
|
-101
|
15
|
Boise
|
ID
|
43
|
-116
|
Obs
|
Var1
|
Var2
|
Var3
|
Var4
|
1
|
Albany/NY/43
|
/-
|
74
|
.
|
2
|
Amarillo/TX/
|
35
|
-102
|
.
|
3
|
Annapolis/MD
|
/3
|
9
|
-77
|
4
|
Atlanta/GA/3
|
4/
|
-84
|
.
|
5
|
Austin/TX/30
|
/-
|
98
|
.
|
6
|
Baltimore/MD
|
/3
|
9
|
-76
|
7
|
Bangor/ME/45
|
/-
|
69
|
.
|
8
|
Birmingham
/A
|
L/
|
33
|
-87
|
9
|
Bismarck/ND/
|
47
|
-101
|
|
Obs
|
Var1
|
Var2
|
Var3
|
var4
|
1
|
Albany
|
NY
|
43
|
-74
|
2
|
Albuquerque
|
NM
|
36
|
-106
|
3
|
Amarillo
|
TX
|
35
|
-102
|
4
|
Anchorage
|
AK
|
61
|
-150
|
5
|
Annapolis
|
MD
|
39
|
-77
|
6
|
Atlanta
|
GA
|
34
|
-84
|
7
|
Augusta
|
ME
|
44
|
-70
|
8
|
Austin
|
TX
|
30
|
-98
|
9
|
Baker
|
OR
|
45
|
-118
|
10
|
Baltimore
|
MD
|
39
|
-76
|
11
|
Bangor
|
ME
|
45
|
-69
|
12
|
Baton Rouge
|
LA
|
31
|
-91
|
13
|
Birmingham
|
AL
|
33
|
-87
|
14
|
Bismarck
|
ND
|
47
|
-101
|
15
|
Boise
|
ID
|
43
|
-116
|