Previous Page | Next Page

SAS Component Language Dictionary

FSEP



Sets the token delimiters for the FGET function
Category: External File

Syntax
Example
See Also

Syntax

sysrc=FSEP(file-id,delimiter);

sysrc

contains the return code for the operation:

0

successful

[ne]0

not successful

Type: Numeric

file-id

specifies the identifier that was assigned when the file was opened. If file-id is invalid, the program halts.

Type: Numeric

delimiter

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.

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

FGET

FREAD

Previous Page | Next Page | Top of Page