Continue with the previous Reading Notes, talk nonsense, and go straight to the topic.
This article focuses on the infile statement.
11: infile statement
DSDIt is required that a dataset can contain delimiters, but must be enclosed in quotation marks. The number between two consecutive delimiters is treated as missing values,The default Delimiter is comma.
Firstobs = Read from this record row
Obs = Number of records to be read
Length = virableAssign the Data Length of the current row to the Temporary Variable variable.
Missover Prevents the input statement from reading data from the next data row, and sets the variable to missing for the value assignment.
Eg:
Filename file 'f: \ data_model \ book_data \ chapt3 \ utf.txt ';
Data Unicode;
Infile file encoding = "UTF-8 ";
Input name $ weight;
Run;
Import a file in the specified encoding format
Eg:
Data num;
Infile datalines dsd dlm = '';
Input x y z;
Datalines;
2 3
4 5 6
79
;
Run;
DSD and DLM can be used together for missing values.
Eg:
Data weather;
Infile datalines missover;
Input temp1-temp5;
Datalines;
97.9 98.1 98.3
98.6 99.2 99.1 98.5 97.5
96.2 97.3 98.3 97.6 96.5
;
Run;
The data at the end of the first row is missing. At this time, the missover is used to force the Data Pointer to read the values of all input variables corresponding to each row.
Study Notes on the business case of SAS programming and Data Mining