FSEP Function


Sets the token delimiters for the FGET function

Category: External Files

Syntax

FSEP ( file-id , character(s) )

Arguments

file-id

  • specifies the identifier that was assigned when the file was opened, generally by the FOPEN function.

character

  • specifies one or more delimiters that separate items in the File Data Buffer (FDB). Each character listed is a delimiter . That is, if character is #@, either # or @ can separate items. Multiple consecutive delimiters, such as @#@, are treated as a single delimiter.

  • Default: blank

Details

FSEP returns 0 if the operation was successful, ‰  0 if it was not successful.

Examples

An external file has data in this form:

 John J. Doe,Male,25,Weight Lifter  Pat O'Neal,Female,22,Gymnast 

Note that each field is separated by a comma.

This example reads the file that is identified by the fileref MYFILE, using the comma as a separator, and writes the values for NAME , GENDER, AGE, and WORK to the SAS log. Note that in a macro statement you do not enclose character strings in quotation marks.

 %let fid=%sysfunc(fopen(myfile));  %let rc=%sysfunc(fsep(&fid,%str(,)));  %do %while(%sysfunc(fread(&fid)) = 0);     %let rc=%sysfunc(fget(&fid,name));     %let rc=%sysfunc(fget(&fid,gender));     %let rc=%sysfunc(fget(&fid,age));     %let rc=%sysfunc(fget(&fid,work));     %put name=%bquote(&name) gender=&gender        age=&age work=&work;  %end;  %let rc=%sysfunc(fclose(&fid)); 

See Also

Functions:

  • 'FCLOSE Function' on page 519

  • 'FGET Function' on page 527

  • 'FOPEN Function' on page 550

  • 'FREAD Function' on page 558

  • 'MOPEN Function' on page 656




SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 704

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net