SAS Component Language Dictionary |
Category: | External File |
Syntax | |
Example | |
See Also |
Syntax |
sysrc=FSEP(file-id,delimiter); |
contains the return code for the operation:
0 | |
0 |
specifies the identifier that was assigned when the file was opened. If file-id is invalid, the program halts.
specifies the token delimiter that separates items in the File Data Buffer (FDB). If multiple characters are specified, each character is considered a delimiter. The default delimiter is a blank.
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);
cval=John J. Doe cval=Male cval=25 cval=Weight Lifter
See Also |
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.