Chapter Contents |
Previous |
Next |
FSEP |
Category: | External File |
Syntax | |
Example | |
See Also |
Syntax |
sysrc=FSEP(file-id,delimiter); |
0 | successful |
0 | not successful |
Type: Numeric
Type: Numeric
Type: Character
Example |
Suppose the external file contains data in this form:
John J. Doe,Male,25,Weight Lifter
Note that each field is separated by a comma.
Read the file identified by the fileref THEFILE, using the comma as a separator, and write the values for NAME, GENDER, AGE, and WORK to the LOG window:
fileid=fopen('thefile'); rc=fsep(fileid,','); sysrc=fread(fileid); rc=fget(fileid,cval); do while (rc ne -1); put cval=; rc=fget (fileid,cval); end; rc=fclose(fileid);
The output of the program is
cval=John J. Doe cval=Male cval=25 cval=Weight Lifter
See Also |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.