Reading Free-Format Data | |
Using List Input |
List input is a powerful tool for reading both standard and nonstandard free-format data. |
General form, INPUT statement using list
input:
where
|
Suppose you have an external data file like the one shown below. The file, referenced by the fileref Credit, contains the results of a survey on credit card use among males and females in the 18-39 age range. |
Raw Data File Credit
1
MALE
27 1 8 0 0
FEMALE
29 3 14 5 10
FEMALE
34 2 10 3 3
MALE
35 2 12 4 8
FEMALE
36 4 16 3 7
MALE
21 1 5 0 0
MALE
25 2 9 2 1
FEMALE
21 1 4 2 6
MALE
38 3 11 4 3
FEMALE
30 3 5 1 0
You need to read the data values for
|
List input may be the easiest input style to use because, as shown in the INPUT statement below, you simply list the variable names in the same order as the corresponding raw data fields. Remember to distinguish character variables from numeric variables. |
input Gender $ Age Bankcard FreqBank Deptcard FreqDept; |
Because list input, by default, does not specify column
locations,
|
Copyright © 2002 SAS Institute Inc.,
Cary, NC, USA. All rights reserved.